UNPKG

@mlightcad/geometry-engine

Version:

The geometry-engine package provides comprehensive geometric entities, mathematical operations, and transformations for 2D and 3D space. This package mimics AutoCAD ObjectARX's AcGe (Geometry) classes and provides the mathematical foundation for CAD opera

61 lines 2.03 kB
import { AcGeBox2d, AcGeMatrix2d, AcGePoint2d } from '../math'; import { AcGeLoop2d } from './AcGeLoop2d'; import { AcGePolyline2d } from './AcGePolyline2d'; import { AcGeShape2d } from './AcGeShape2d'; export interface AcGeIndexNode { index: number; children: AcGeIndexNode[]; } export type AcGeLoop2dType = AcGeLoop2d | AcGePolyline2d; /** * 2d area defined by one outter loop and multiple inner loops */ export declare class AcGeArea2d extends AcGeShape2d { private _loops; /** * Create one 2d area defined by one outter loop and multiple inner loops */ constructor(); /** * Append one loop to loops of this area. If it is the first loop added, it is the outter loop. * Otherwise, it is an inner loop. * @param loop Input the loop to append */ add(loop: AcGeLoop2dType): void; /** * The loops of this area */ get loops(): ReadonlyArray<AcGeLoop2dType>; /** * Outter loop of this area */ get outter(): AcGeLoop2dType | undefined; /** * @inheritdoc */ calculateBoundingBox(): AcGeBox2d; /** * @inheritdoc */ transform(_matrix: AcGeMatrix2d): this; /** * Return boundary points of this area * @param numPoints Input the nubmer of points returned for arc segmentation * @returns Return points */ getPoints(numPoints: number): AcGePoint2d[][]; buildHierarchy(): AcGeIndexNode; /** * Calcuate bounding box of each loop in this area and return an array of their bounding box * @param pointBoundaries An array of loop consisted by points * @returns Return an array of bounding box */ private calculateBoundaryBoxes; /** * Sort boundary boxes by its area and return the index of boundary boxes array * @param boundaryBoxes An array of boundary bounding box * @returns Return an index array of boundary bounding box sorted by its area */ private sortBoundaryBoxesByAreas; } //# sourceMappingURL=AcGeArea2d.d.ts.map