triangulate() public method

Computes a triangle list that fully covers the area enclosed by the given set of points. If points are not CCW, pass false for the arePointsCCW parameter
public triangulate ( Vector2 points, bool arePointsCCW = true ) : void
points Vector2 A list of points that defines an enclosing path.
arePointsCCW bool
return void
Example #1
0
		public PolygonMesh( Vector2[] points, bool arePointsCCW = true )
		{
			var triangulator = new Triangulator();
			triangulator.triangulate( points, arePointsCCW );

			setVertPositions( points );
			setTriangles( triangulator.triangleIndices.ToArray() );
			recalculateBounds( true );
		}
Example #2
0
        public PolygonMesh(Vector2[] points)
        {
            var triangulator = new Triangulator();

            triangulator.triangulate(points);

            setVertPositions(points);
            setTriangles(triangulator.triangleIndices.ToArray());
            recalculateBounds(true);
        }
Example #3
0
        public PolygonMesh(Vector2[] points, bool arePointsCCW = true)
        {
            var triangulator = new Triangulator();

            triangulator.triangulate(points, arePointsCCW);

            SetVertPositions(points);
            SetTriangles(triangulator.triangleIndices.ToArray());
            RecalculateBounds(true);
        }