ts-scikit
Version:
A scientific toolkit written in Typescript
102 lines (101 loc) • 3.88 kB
TypeScript
import { Point3 } from './point3';
import { Vector3 } from './vector3';
import { Matrix44 } from './matrix44';
/**
* A plane.
* A plane divides a 3D space into points above it, points below it, and
* points within it. The signed distance s from a point (x, y, z) to a plane
* is s = a*x + b*y + c*z + d, where (a, b, c, d) are coefficients that
* define the plane. Points within the plane satisfy the equation s = 0.
*/
export declare class Plane {
a: number;
b: number;
c: number;
d: number;
/**
* Constructs a plane.
* The plane will contain the specified point p and the orthogonal
* to the specified normal vector n, which points toward the space above
* the plane.
* @param p the point in the plane.
* @param n the normal vector.
*/
static FromPointAndNormal(p: Point3, n: Vector3): Plane;
/**
* Constructs a plane with specified coefficients.
* @param a the coefficient a.
* @param b the coefficient b.
* @param c the coefficient c.
* @param d the coefficient d.
*/
static FromPlanarCoefficients(a: number, b: number, c: number, d: number): Plane;
/**
* Constructs a copy of the specified plane.
* @param p the plane.
*/
static FromPlane(p: Plane): Plane;
constructor(a: number, b: number, c: number, d: number);
/**
* The unit-vector normal to this plane.
* The vector poitns toward the space above the plane.
*/
get normal(): Vector3;
/**
* Clones this plane.
* @returns a copy of this plane.
*/
clone(): Plane;
/**
* Returns the signed distnace from this plane to a specified point.
* Distance is negative for points below the plane, zero for points
* within the plane, and positive for points above the plane.
* @param p the point.
* @returns the signed distance.
*/
distanceToPoint(p: Point3): number;
/**
* Returns the signed distnace from this plane to a specified point.
* Distance is negative for points below the plane, zero for points
* within the plane, and positive for points above the plane.
* @param x the x-coordinate of the point.
* @param y the y-coordinate of the point.
* @param z the z-coordinate of the point.
* @returns the signed distance.
*/
distanceTo(x: number, y: number, z: number): number;
/**
* Transforms this plane, given the specified transform matrix.
* If the inverse of the transform matrix is konwn, the method
* {@link #transformWithInverse()} is more efficient.
*
* Let M denote the matrix that transforms points p from old to new
* coordinates; i.e., p' = M*p, where p' denotes a transformed point.
* In old coordinates, the plane P = (a, b, c, d) satisfies the equation
* a*x + b*y + c*z + d = 0, for all points p = (x, y, z) within the plane.
* This method returns a new transformed plane P' = (a',b',c',d') that
* satisfies the equation a'*x' + b'*y' + c'*z' + d' = 0 for all
* transformed points p' = (x',y',z') within the transformed plane.
* @param m the transform matrix.
*/
transform(m: Matrix44): void;
/**
* Transforms this plane, given the inverse of the transform matrix.
* If the inverse of the transform matrix is known, this method is more
* more efficient than the method {@link #transform(Matrix44)}.
* @param inv the inverse of the transform matrix.
*/
transformWithInverse(inv: Matrix44): void;
/**
* Sets the coefficients of this plane.
* @param a the coefficient a.
* @param b the coefficient b.
* @param c the coefficient c.
* @param d the coefficient d.
*/
set(a: number, b: number, c: number, d: number): void;
/**
* Normalizes this plane's coefficients.
*/
normalize(): void;
}