@babylonjs/core
Version:
Getting started? Play directly with the Babylon.js API using our [playground](https://playground.babylonjs.com/). It also contains a lot of samples to learn how to use it.
103 lines (102 loc) • 3.52 kB
TypeScript
import type { Scene } from "../scene.js";
import { Vector2 } from "../Maths/math.vector.js";
import { Mesh } from "../Meshes/mesh.js";
import { VertexData } from "../Meshes/mesh.vertexData.js";
import { Path2 } from "../Maths/math.path.js";
/**
* 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;
}