@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
134 lines • 5.55 kB
TypeScript
import { AcGeBox3d, AcGeMatrix3d, AcGePoint3d, AcGePoint3dLike, AcGeVector3d } from '../math';
import { AcGeCurve3d } from './AcGeCurve3d';
/**
* The class represents one 3d line geometry specified by its start point and end point.
*/
export declare class AcGeLine3d extends AcGeCurve3d {
private _start;
private _end;
/**
* This constructor initializes the line object to use start as the start point, and end
* as the endpoint. Both points must be in WCS coordinates.
*/
constructor(start: AcGePoint3dLike, end: AcGePoint3dLike);
/**
* The line's startpoint in WCS coordinates
*/
get startPoint(): AcGePoint3d;
set startPoint(value: AcGePoint3dLike);
/**
* The line's endpoint in WCS coordinates
*/
get endPoint(): AcGePoint3d;
set endPoint(value: AcGePoint3dLike);
/**
* Normalized direction vector of this line
*/
get direction(): AcGeVector3d;
/**
* The middle point of this line.
*/
get midPoint(): AcGePoint3d;
/**
* @inheritdoc
*/
get length(): number;
/**
* Check whether the specified point is on this line.
* @param point Input point to check
* @returns Return true if the specified point is on this line. Otherwise, return false.
*/
isPointOnLine(point: AcGePoint3dLike): boolean;
/**
* Return a point at a certain position along the line. When t = 0, it returns the start point,
* and when t = 1 it returns the end point.
* @param t Use values 0-1 to return a position along the line.
* @param target The result will be copied into this point.
* @returns Return a point at a certain position along the line.
*/
at(t: number, target: AcGePoint3d): AcGeVector3d;
/**
* Return a point at a certain position along the line.
* - If `flag` is false, use the length from start point to determinate the point
* - If `flag` is true, use the length from end point to determinate the point
* @param length Use this length value to return a position along the line.
* @returns Return a point at a certain position along the line.
*/
atLength(length: number, flag?: boolean): AcGePoint3d;
/**
* Extend this line with the specified length
* @param length Input the length of extension
* @param inversed Input the flag to determinate which point is used to calculate the length
* - ture: start point is used as the start point of the line extension
* - false: end point is used as the start point of the line extension
*/
extend(length: number, inversed?: boolean): this;
/**
* Return a point parameter based on the closest point as projected on the line segment. If clampToLine
* is true, then the returned value will be between 0 and 1.
* @param point Input the point for which to return a point parameter.
* @param clampToLine Whether to clamp the result to the range [0, 1].
* @returns Return a point parameter based on the closest point as projected on the line segment.
*/
closestPointToPointParameter(point: AcGePoint3d, clampToLine: boolean): number;
/**
* Return the closets point on the line. If clampToLine is true, then the returned value will be
* clamped to the line segment.
* @param point Return the closest point on the line to this point.
* @param clampToLine Whether to clamp the returned value to the line segment.
* @param target The result will be copied into this point.
* @returns Return the closets point on the line.
*/
closestPointToPoint(point: AcGePoint3d, clampToLine: boolean, target: AcGePoint3d): AcGeVector3d;
/**
* Returns the delta vector of the line segment (end vector minus the start vector).
* @param target The result will be copied into this vector.
* @returns Return the delta vector of the line segment (end vector minus the start vector).
*/
delta(target: AcGeVector3d): AcGeVector3d;
/**
* Return the square of the Euclidean distance (straight-line distance) between the line's start and
* end point.
* @returns Return the square of the Euclidean distance (straight-line distance) between the line's
* start and end point.
*/
distanceSq(): number;
/**
* Return the Euclidean distance (straight-line distance) between the line's start and end points.
* @returns Return the Euclidean distance (straight-line distance) between the line's start and end points.
*/
distance(): number;
/**
* Project a 3d point onto this line
*/
project(pt: AcGePoint3dLike): AcGePoint3d;
/**
* Finds the point on the line that is perpendicular to the given point. When you need the shortest distance
* between the given point and the line, perpPoint gives the point on the line that is the closest to the
* given point.
* @param point Input one point to calculate the point on the line that is the closest to this point
* @returns Return the point on the line that is the closest to the given point.
*/
perpPoint(point: AcGePoint3d): AcGePoint3d;
/**
* @inheritdoc
*/
calculateBoundingBox(): AcGeBox3d;
/**
* @inheritdoc
*/
transform(matrix: AcGeMatrix3d): this;
/**
* @inheritdoc
*/
get closed(): boolean;
/**
* @inheritdoc
*/
copy(value: AcGeLine3d): this;
/**
* @inheritdoc
*/
clone(): AcGeLine3d;
}
//# sourceMappingURL=AcGeLine3d.d.ts.map