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

132 lines 4.97 kB
import { AcGeBox2d, AcGeMatrix2d, AcGePoint2d, AcGePoint2dLike } from '../math'; import { AcGeCurve2d } from './AcGeCurve2d'; /** * Represent a circular arc. * * The angle system behavior depends on the clockwise property: * - If clockwise = false (counterclockwise): Angles are stored in normal mathematical sense * (0° = +X axis, 90° = +Y axis, 180° = -X axis, 270° = -Y axis) * - If clockwise = true: Angles are stored in a mirrored system where positive angles go clockwise * (0° = +X axis, 270° = +Y axis, 180° = -X axis, 90° = -Y axis) * * This means a "90° above X axis" in counterclockwise mode becomes "270°" in clockwise mode. */ export declare class AcGeCircArc2d extends AcGeCurve2d { private _center; private _radius; private _startAngle; private _endAngle; private _clockwise; constructor(p1: AcGePoint2dLike, p2: AcGePoint2dLike, p3: AcGePoint2dLike); constructor(start: AcGePoint2dLike, end: AcGePoint2dLike, bulge: number); constructor(center: AcGePoint2dLike, radius: number, startAngle: number, endAngle: number, clockwise: boolean); /** * Create arc by three points * @param p1 Input the start point * @param p2 Input one point between the start point and the end point * @param p3 Input the end point */ private createByThreePoints; /** * Create circular arc by two points and one bugle factor * @param from Input start point * @param to Input end point * @param bulge Input 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 */ private createByStartEndPointsAndBulge; /** * Center of circular arc */ get center(): AcGePoint2d; set center(value: AcGePoint2dLike); /** * Radius of circular arc */ get radius(): number; set radius(value: number); /** * Start angle in radians of circular arc in the range 0 to 2 * PI. * If clockwise=true, angles are mirrored (0 = +X, 270° = +Y, 180° = -X, 90° = -Y). * If clockwise=false, angles are in normal mathematical sense (0 = +X, 90° = +Y, 180° = -X, 270° = -Y). */ get startAngle(): number; set startAngle(value: number); /** * End angle in radians of circular arc in the range 0 to 2 * PI. * If clockwise=true, angles are mirrored (0 = +X, 270° = +Y, 180° = -X, 90° = -Y). * If clockwise=false, angles are in normal mathematical sense (0 = +X, 90° = +Y, 180° = -X, 270° = -Y). */ get endAngle(): number; set endAngle(value: number); /** * Mirror an angle for clockwise mode: 0° stays 0°, 90° becomes 270°, 180° stays 180°, 270° becomes 90° * @param angle Input angle in radians * @returns Mirrored angle in radians */ private _mirrorAngle; /** * Get the internal (unmirrored) angle for calculations * @param angle Input angle (may be mirrored) * @returns Internal angle for calculations */ private _getInternalAngle; /** * Angle between endAngle and startAngle in range 0 to 2*PI */ get deltaAngle(): number; /** * Rotation direction of the arc. */ get clockwise(): boolean; set clockwise(value: boolean); /** * Start point of circular arc */ get startPoint(): AcGePoint2d; /** * End point of circular arc */ get endPoint(): AcGePoint2d; /** * Middle point of circular arc */ get midPoint(): AcGePoint2d; /** * Return true if its start point is identical to its end point. Otherwise, return false. */ get closed(): boolean; /** * @inheritdoc */ calculateBoundingBox(): AcGeBox2d; /** * Get length of circular arc */ get length(): number; /** * @inheritdoc */ transform(_matrix: AcGeMatrix2d): this; /** * @inheritdoc */ clone(): AcGeCircArc2d; /** * Calculate a point on the ellipse at a given angle. * @param angle Input the angle in radians where the point is to be calculated. * @returns Return the 2d coordinates of the point on the circular arc. */ getPointAtAngle(angle: number): AcGePoint2d; /** * Divide this arc into the specified nubmer of points and return those points as an array of points. * @param numPoints Input the nubmer of points returned * @returns Return an array of points */ getPoints(numPoints?: number): AcGePoint2d[]; } //# sourceMappingURL=AcGeCircArc2d.d.ts.map