123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 |
- import type { Scene } from "../scene";
- import { Vector2 } from "../Maths/math.vector";
- import { Mesh } from "../Meshes/mesh";
- import { VertexData } from "../Meshes/mesh.vertexData";
- import { Path2 } from "../Maths/math.path";
- /**
- * Polygon
- * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param#non-regular-polygon
- */
- export declare class Polygon {
- /**
- * Creates a rectangle
- * @param xmin bottom X coord
- * @param ymin bottom Y coord
- * @param xmax top X coord
- * @param ymax top Y coord
- * @returns points that make the resulting rectangle
- */
- static Rectangle(xmin: number, ymin: number, xmax: number, ymax: number): Vector2[];
- /**
- * Creates a circle
- * @param radius radius of circle
- * @param cx scale in x
- * @param cy scale in y
- * @param numberOfSides number of sides that make up the circle
- * @returns points that make the resulting circle
- */
- static Circle(radius: number, cx?: number, cy?: number, numberOfSides?: number): Vector2[];
- /**
- * Creates a polygon from input string
- * @param input Input polygon data
- * @returns the parsed points
- */
- static Parse(input: string): Vector2[];
- /**
- * Starts building a polygon from x and y coordinates
- * @param x x coordinate
- * @param y y coordinate
- * @returns the started path2
- */
- static StartingAt(x: number, y: number): Path2;
- }
- /**
- * Builds a polygon
- * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/creation/param/polyMeshBuilder
- */
- export declare class PolygonMeshBuilder {
- private _points;
- private _outlinepoints;
- private _holes;
- private _name;
- private _scene;
- private _epoints;
- private _eholes;
- private _addToepoint;
- /**
- * Babylon reference to the earcut plugin.
- */
- bjsEarcut: any;
- /**
- * Creates a PolygonMeshBuilder
- * @param name name of the builder
- * @param contours Path of the polygon
- * @param scene scene to add to when creating the mesh
- * @param earcutInjection can be used to inject your own earcut reference
- */
- constructor(name: string, contours: Path2 | Vector2[] | any, scene?: Scene, earcutInjection?: any);
- /**
- * Adds a hole within the polygon
- * @param hole Array of points defining the hole
- * @returns this
- */
- addHole(hole: Vector2[]): PolygonMeshBuilder;
- /**
- * Creates the polygon
- * @param updatable If the mesh should be updatable
- * @param depth The depth of the mesh created
- * @param smoothingThreshold Dot product threshold for smoothed normals
- * @returns the created mesh
- */
- build(updatable?: boolean, depth?: number, smoothingThreshold?: number): Mesh;
- /**
- * Creates the polygon
- * @param depth The depth of the mesh created
- * @param smoothingThreshold Dot product threshold for smoothed normals
- * @returns the created VertexData
- */
- buildVertexData(depth?: number, smoothingThreshold?: number): VertexData;
- /**
- * Adds a side to the polygon
- * @param positions points that make the polygon
- * @param normals normals of the polygon
- * @param uvs uvs of the polygon
- * @param indices indices of the polygon
- * @param bounds bounds of the polygon
- * @param points points of the polygon
- * @param depth depth of the polygon
- * @param flip flip of the polygon
- * @param smoothingThreshold
- */
- private _addSide;
- }
|