static public Mesh CreateCircleOutline(float width, int number_vertexs) { Mesh mesh = new Mesh(); int ring_vertexs = number_vertexs / 2; mesh.vertices = Floats.Line(0.0f, 360.0f, ring_vertexs, true) .Convert(a => Vector2Extensions.CreateDirectionFromDegrees(a).GetSpacar() * 0.5f) .Append( Floats.Line(0.0f, 360.0f, ring_vertexs, true) .Convert(a => Vector2Extensions.CreateDirectionFromDegrees(a).GetSpacar() * (0.5f - width)) ) .ToArray(); mesh.triangles = Ints.Range(0, ring_vertexs, false) .ConvertConnections((p1, p2) => Enumerable.New( p1 + ring_vertexs, p2, p1, p1 + ring_vertexs, p2 + ring_vertexs, p2 ) ) .ToArray(); mesh.RecalculateNormals(); mesh.RecalculateBounds(); return(mesh); }
static public void CalculateTrianglesAsSequentialQuads(this Mesh item) { item.triangles = Ints.Range(0, item.vertexCount, 4, false) .Convert(i => Enumerable.New(i, i + 1, i + 2, i, i + 2, i + 3)) .Flatten() .ToArray(); }
protected override LayerMask DrawBuiltInInternal(Rect rect, GUIContent label, LayerMask value) { return(EditorGUI.MaskField( rect, label, value.value, Ints.Range(0, 31, true).Convert(i => LayerMask.LayerToName(i)).ToArray() )); }
static public Mesh MakeFlatMesh(this IEnumerable <Triangle3> item) { Mesh mesh = new Mesh(); mesh.vertices = item.Convert(t => t.GetPoints()).Flatten().ToArray(); mesh.triangles = Ints.Range(0, mesh.vertexCount, false).ToArray(); mesh.RecalculateBounds(); mesh.RecalculateNormals(); return(mesh); }
static public Mesh BuildFlatMesh(this MeshBuilder item) { Mesh mesh = new Mesh(); Vector3[] vertexs = item.GetVertexs().AtIndexs(item.GetIndexs()).ToArray(); mesh.vertices = vertexs; mesh.triangles = Ints.Range(0, vertexs.Length, false).ToArray(); mesh.RecalculateNormals(); mesh.RecalculateBounds(); return(mesh); }
static public IEnumerable <OctoMask> GetAll() { return(Ints.Range(0, ByteBits.ALL_BITS, true).Convert(b => new OctoMask((byte)b))); }
public void TailTest() { Assert2.SequenceEqual(Ints.Range(10, 100), Ints.Range(9, 100).Tail()); }
static public void CalculateTrianglesAsFan(this Mesh item) { item.triangles = Ints.Range(1, item.vertexCount, false) .ConvertConnections((p1, p2) => Enumerable.New(0, p2, p1)) .ToArray(); }
static public void CalculateTrianglesAsSequential(this Mesh item) { item.triangles = Ints.Range(0, item.vertexCount, false) .ToArray(); }