UNPKG

1.24 kBTypeScriptView Raw
1import { Vector2Like } from "../math/Vector2.js";
2
3/**
4 * A class containing utility functions for shapes.
5 * @remarks Note that these are all linear functions so it is necessary to calculate separately for x, y (and z, w if present) components of a vector.
6 * @see {@link https://threejs.org/docs/index.html#api/en/extras/ShapeUtils | Official Documentation}
7 * @see {@link https://github.com/mrdoob/three.js/blob/master/src/extras/ShapeUtils.js | Source}
8 */
9export class ShapeUtils {
10 /**
11 * Calculate area of a ( 2D ) contour polygon.
12 */
13 static area(contour: readonly Vector2Like[]): number;
14
15 /**
16 * Note that this is a linear function so it is necessary to calculate separately for x, y components of a polygon.
17 * @remarks Used internally by {@link THREE.Path | Path}, {@link THREE.ExtrudeGeometry | ExtrudeGeometry} and {@link THREE.ShapeGeometry | ShapeGeometry}.
18 */
19 static isClockWise(pts: readonly Vector2Like[]): boolean;
20
21 /**
22 * Used internally by {@link THREE.ExtrudeGeometry | ExtrudeGeometry} and {@link THREE.ShapeGeometry | ShapeGeometry} to calculate faces in shapes with holes.
23 */
24 static triangulateShape(contour: Vector2Like[], holes: Vector2Like[][]): number[][];
25}