@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
131 lines (130 loc) • 5.71 kB
TypeScript
import { AcGeBox3d } from './AcGeBox3d';
import { AcGeMatrix2d } from './AcGeMatrix2d';
import { AcGeMatrix3d } from './AcGeMatrix3d';
import { AcGeVector3d, AcGeVector3dLike } from './AcGeVector3d';
/**
* A two dimensional surface that extends infinitely in 3d space, represented in Hessian normal form
* by a unit length normal vector and a constant.
*/
export declare class AcGePlane {
normal: AcGeVector3d;
constant: number;
/**
* Create one plane
* @param normal (optional) Input a unit length Vector3 defining the normal of the plane.
* Default is (1, 0, 0).
* @param constant (optional) Input the signed distance from the origin to the plane. Default is 0.
*/
constructor(normal?: AcGeVector3d, constant?: number);
/**
* Set this plane's normal and constant properties by copying the values from the given normal.
* @param normal Input a unit length 3d vector defining the normal of the plane.
* @param constant Input the signed distance from the origin to the plane.
* @returns Return this plane
*/
set(normal: AcGeVector3dLike, constant: number): this;
/**
* Set the individual components that define the plane.
* @param x Input x value of the unit length normal vector.
* @param y Input y value of the unit length normal vector.
* @param z Input z value of the unit length normal vector.
* @param w Input the value of the plane's constant property.
* @returns Return this plane
*/
setComponents(x: number, y: number, z: number, w: number): this;
/**
* Set the plane's properties as defined by a normal and an arbitrary coplanar point.
* @param normal Input a unit length Vector3 defining the normal of the plane.
* @param point Input an arbitrary coplanar point.
* @returns Return this plane
*/
setFromNormalAndCoplanarPoint(normal: AcGeVector3dLike, point: AcGeVector3d): this;
/**
* Defines the plane based on the 3 provided points. The winding order is assumed to be
* counter-clockwise, and determines the direction of the normal.
* @param a Input the first point on the plane.
* @param b Input the second point on the plane.
* @param c Input the third point on the plane.
* @returns Return this plane
*/
setFromCoplanarPoints(a: AcGeVector3d, b: AcGeVector3d, c: AcGeVector3d): this;
/**
* Copy the values of the passed plane's normal and constant properties to this plane.
* @param plane Input the plane to copy
* @returns Return this plane
*/
copy(plane: AcGePlane): this;
/**
* Normalize the normal vector, and adjusts the constant value accordingly.
* @returns Return this plane
*/
normalize(): this;
/**
* Negate both the normal vector and the constant.
* @returns Return this plane
*/
negate(): this;
/**
* Return the signed distance from the point to the plane.
* @param point Input one 3d point
* @returns Return the caculated distance
*/
distanceToPoint(point: AcGeVector3dLike): number;
/**
* Project a point onto the plane.
* @param point Input a point to be projected
* @param target Input the result to be copied into.
* @returns Return the target
*/
projectPoint(point: AcGeVector3dLike, target: AcGeVector3d): AcGeVector3d;
/**
* Return the intersection point of the passed line and the plane. Returns null if the line does not
* intersect. Returns the line's starting point if the line is coplanar with the plane.
* @param line Input the 3d line to check for intersection.
* @param target Input the result will be copied into this Vector3.
* @returns Return the target
*/
/**
* Determine whether or not this plane intersects box.
* @param box Input the 3d box to check for intersection.
* @returns Return true if this plane intersects the specified 3d box.
*/
intersectsBox(box: AcGeBox3d): boolean;
/**
* Returns a 3d vector coplanar to the plane, by calculating the projection of the normal vector at the
* origin onto the plane.
* @param target Input the result will be copied into this 3d vector.
* @returns Return the 3d vector coplanar to the plane
*/
coplanarPoint(target: AcGeVector3d): AcGeVector3d;
/**
* Apply a Matrix4 to the plane. The matrix must be an affine, homogeneous transform.
* If supplying an optionalNormalMatrix, it can be created like so:
* <pre>
* const optionalNormalMatrix = new THREE.Matrix3().getNormalMatrix( matrix );
* </pre>
* @param matrix Input the Matrix4 to apply.
* @param optionalNormalMatrix (optional) Input pre-computed normal Matrix3 of the Matrix4 being applied.
* @returns Return this plane
*/
applyMatrix4(matrix: AcGeMatrix3d, optionalNormalMatrix: AcGeMatrix2d): this;
/**
* Translates the plane by the distance defined by the offset vector. Note that this only affects the
* plane constant and will not affect the normal vector.
* @param offset Input the amount to move the plane by.
* @returns Return this plane
*/
translate(offset: AcGeVector3d): this;
/**
* Check to see if two planes are equal (their normal and constant properties match).
* @param plane Input the plane to compare with this one.
* @returns Return true if two planes are equal
*/
equals(plane: AcGePlane): boolean;
/**
* Return a new plane with the same normal and constant as this one.
* @returns Return the cloned plane
*/
clone(): AcGePlane;
}
//# sourceMappingURL=AcGePlane.d.ts.map