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

126 lines 4.23 kB
import { AcGeBox3d, AcGeMatrix3d, AcGePoint3d, AcGePoint3dLike, AcGePointLike } from '../math'; import { AcGeCurve3d } from './AcGeCurve3d'; export type AcGeKnotParameterizationType = 'Uniform' | 'Chord' | 'SqrtChord'; /** * Lightweight NURBS curve implementation */ declare class NurbsCurve { private _degree; private _knots; private _controlPoints; private _weights; constructor(degree: number, knots: number[], controlPoints: number[][], weights?: number[]); degree(): number; knots(): number[]; controlPoints(): number[][]; weights(): number[]; /** * Calculate a point on the curve at parameter u */ point(u: number): number[]; /** * Calculate curve length using numerical integration */ length(): number; /** * Create a NURBS curve from control points and knots */ static byKnotsControlPointsWeights(degree: number, knots: number[], controlPoints: number[][], weights?: number[]): NurbsCurve; /** * Create a NURBS curve from fit points using interpolation */ static byPoints(points: number[][], degree: number, parameterization?: AcGeKnotParameterizationType): NurbsCurve; } export declare class AcGeSpline3d extends AcGeCurve3d { private _nurbsCurve; private _fitPoints?; private _knotParameterization?; private _controlPoints; private _closed; private _originalControlPoints?; private _originalKnots?; private _originalWeights?; constructor(controlPoints: AcGePointLike[], knots: number[], weights?: number[], closed?: boolean); constructor(fitPoints: AcGePointLike[], knotParam: AcGeKnotParameterizationType, closed?: boolean); /** * Set the closed property and rebuild the curve if necessary */ private setClosed; /** * Make the spline closed by adding control points and adjusting knots */ private makeClosed; /** * Make the spline open by restoring the original curve */ private makeOpen; /** * Create knot vector for closed curve */ private createClosedKnotVector; /** * Degree of the spline to be created. */ get degree(): number; get knotParameterization(): AcGeKnotParameterizationType | undefined; /** * The start point of this spline */ get startPoint(): AcGePoint3d; /** * The end point of this spline */ get endPoint(): AcGePoint3d; /** * @inheritdoc */ get length(): number; /** * Return the value of the control point at position index in the list of control points. * If index is negative or more than the number of control points in the spline, then point * is set to the last control point. * @param index Input index (0 based) of point to get * @returns */ getFitPointAt(index: number): AcGePoint3dLike; /** * Return the value of the control point at position index in the list of control points. * If index is negative or more than the number of control points in the spline, then point * is set to the last control point. * @param index Input index (0 based) of point to get * @returns */ getControlPointAt(index: number): import("../math").AcGeVectorLike; /** * Divide this spline into the specified nubmer of points * those points as an array of points. * @param numPoints Input the nubmer of points returned * @returns Return an array of point */ getPoints(numPoints?: number): AcGePoint3d[]; getCurvePoints(curve: NurbsCurve, count: number): number[][]; /** * @inheritdoc */ calculateBoundingBox(): AcGeBox3d; get closed(): boolean; set closed(value: boolean); /** * @inheritdoc */ transform(_matrix: AcGeMatrix3d): this; /** * Convert input points to points in NURBS format * @param points Input points to convert * @returns Return converted points */ private toNurbsPoints; /** * Convert input points to points in geometry engine format * @param points Input points to convert * @returns Return converted points */ private toGePoints; } export {}; //# sourceMappingURL=AcGeSpline3d.d.ts.map