import VertexData from "../rendering/VertexData"; import IndexData from "../rendering/IndexData"; import Point from "openfl/geom/Point"; import Vector from "openfl/Vector"; declare namespace starling.geom { /** * A polygon describes a closed two-dimensional shape bounded by a number of straight * * line segments. * * * *
The vertices of a polygon form a closed path (i.e. the last vertex will be connected * * to the first). It is recommended to provide the vertices in clockwise order. * * Self-intersecting paths are not supported and will give wrong results on triangulation, * * area calculation, etc.
* */ export class Polygon { /** * Creates a Polygon with the given coordinates. * * @param vertices an array that contains either 'Point' instances or * * alternating 'x' and 'y' coordinates. * */ constructor(vertices?: ArrayIf you pass an indexData object, the new indices will be appended to it. * * Otherwise, a new instance will be created.
*/ triangulate(indexData?: IndexData, offset?: number): IndexData; /** * Copies all vertices to a 'VertexData' instance, beginning at a certain target index. */ copyToVertexData(target: VertexData, targetVertexID?: number, attrName?: string): void; /** * Creates a string that contains the values of all included points. */ toString(): string; /** * Indicates if the polygon's line segments are not self-intersecting. * * Beware: this is a brute-force implementation withO(n^2).
*/
get isSimple(): boolean;
/**
* Indicates if the polygon is convex. In a convex polygon, the vector between any two
* * points inside the polygon lies inside it, as well.
*/
get isConvex(): boolean;
/**
* Calculates the total area of the polygon.
*/
get area(): number;
/**
* Returns the total number of vertices spawning up the polygon. Assigning a value
* * that's smaller than the current number of vertices will crop the path; a bigger
* * value will fill up the path with zeros.
*/
get numVertices(): number;
set numVertices(value: number)
/**
* Returns the number of triangles that will be required when triangulating the polygon.
*/
get numTriangles(): number;
}
}
export default starling.geom.Polygon;