@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
90 lines • 3.3 kB
TypeScript
import { AcGeBox2d, AcGeMatrix2d, AcGePoint2d, AcGePoint3d } from '../math';
import { AcGeCurve2d } from './AcGeCurve2d';
/**
* The class represents one vertex of the polyline geometry.
*/
export interface AcGePolyline2dVertex {
x: number;
y: number;
/**
* The bulge factor used to indicate how much of an arc segment is present at this vertex.
* The bulge factor is the tangent of one fourth the included angle for an arc segment, made
* negative if the arc goes clockwise from the start point to the endpoint. A bulge of 0 indicates a
* straight segment, and a bulge of 1 is a semicircle. Get more details from the following links.
* - https://ezdxf.readthedocs.io/en/stable/dxfentities/lwpolyline.html
* - https://www.afralisp.net/archive/lisp/Bulges1.htm
*/
bulge?: number;
}
/**
* The class represents the polyline geometry.
*/
export declare class AcGePolyline2d<T extends AcGePolyline2dVertex = AcGePolyline2dVertex> extends AcGeCurve2d {
private _closed;
private _vertices;
constructor(vertices?: Array<T> | null, closed?: boolean);
/**
* The number of vertices in the polyline
*/
get numberOfVertices(): number;
/**
* @inheritdoc
*/
get closed(): boolean;
/**
* Start point of this polyline
*/
get startPoint(): AcGePoint2d;
/**
* End point of this polyline
*/
get endPoint(): AcGePoint2d;
/**
* @inheritdoc
*/
get length(): number;
/**
* Set the polyline to be closed (that is, there is a segment drawn from the last vertex to the first)
* if 'value' is true. Set the polyline to be open (no segment between the last and first vertices) if
* 'value' is false.
*/
set closed(value: boolean);
/**
* This function adds a vertex to the polyline. If index is 0, the vertex will become the first
* vertex of the polyline. If index is the value returned by this.numberOfVertices, then the vertex
* will become the last vertex of the polyline. Otherwise the vertex will be added just before the
* index vertex.
*
* @param index Input index (0 based) before which to insert the vertex
* @param vertex Input vertex location point
*/
addVertexAt(index: number, vertex: T): void;
/**
* Get the 2d location of the vertex index in the polyline's own object coordinate system (OCS).
*
* @param index Input index (0 based) of the vertex
*/
getPointAt(index: number): AcGePoint2d;
/**
* @inheritdoc
*/
calculateBoundingBox(): AcGeBox2d;
/**
* @inheritdoc
*/
transform(_matrix: AcGeMatrix2d): this;
/**
* Return an array of points to draw this polyline.
* @param numPoints Input the nubmer of points returned for arc segmentation
* @param elevation Input z value of points returned
* @returns Return an array of point
*/
getPoints3d(numPoints: number, elevation: number): AcGePoint3d[];
/**
* Return an array of points to draw this polyline.
* @param numPoints Input the nubmer of points returned for arc segmentation
* @returns Return an array of point
*/
getPoints(numPoints: number): AcGePoint2d[];
}
//# sourceMappingURL=AcGePolyline2d.d.ts.map