UNPKG

@achirita/blox

Version:

A CAD library for building 3D models in the browser.

92 lines (91 loc) 3.1 kB
import { Vector, Axis } from './index'; import { Face } from '../modeling'; export class Plane { /** * Creates a `Plane` object from a given `Face` object. * @param {Face} face - The face from which to create a `Plane` object. * @returns {Plane|undefined} A new `Plane` object if the face is a plane, otherwise `undefined`. */ static fromFace(face: Face): Plane | undefined; /** * Creates a `Plane` object representing the XY plane. * @returns {Plane} A new `Plane` object representing the XY plane. */ static XY: Plane; /** * Creates a `Plane` object representing the YX plane. * @returns {Plane} A new `Plane` object representing the YX plane. */ static YX: Plane; /** * Creates a `Plane` object representing the YZ plane. * @returns {Plane} A new `Plane` object representing the YZ plane. */ static YZ: Plane; /** * Creates a `Plane` object representing the ZY plane. * @returns {Plane} A new `Plane` object representing the ZY plane. */ static ZY: Plane; /** * Creates a `Plane` object representing the XZ plane. * @returns {Plane} A new `Plane` object representing the XZ plane. */ static XZ: Plane; /** * Creates a `Plane` object representing the ZX plane. * @returns {Plane} A new `Plane` object representing the ZX plane. */ static ZX: Plane; constructor({ origin, normal, xDirection }: { origin: any; normal: any; xDirection: any; }); /** * Returns the wrapped OpenCascade object. * @private */ private get wrapped(); /** * Returns the origin of the plane. * @returns {Vector} The origin of the plane. */ get origin(): Vector; /** * Returns the normal vector of the plane. * @returns {Vector} The normal vector of the plane. */ get normal(): Vector; /** * Returns the x-direction vector of the plane. * @returns {Vector} The x-direction vector of the plane. */ get xDirection(): Vector; /** * Returns the axis of the plane. * @returns {Axis} An `Axis` object representing the plane's axis. */ get axis(): Axis; /** * Transforms the given OpenCascade object to local coordinates of this plane. * @private * @param {*} transformable - An OpenCascade object that can be transformed. * @returns The transformed opencascade object. */ private toLocalCoordinates; /** * Transforms the given OpenCascade object to world coordinates from local coordinates of this plane. * @private * @param {*} transformable - An OpenCascade object that can be transformed. * @returns The transformed opencascade object. */ private toWorldCoordinates; /** * Offsets the plane by a given vector. * @param {Vector} offset - The offset vector to apply to the plane's origin. * @returns {Plane} A new `Plane` object with the origin offset by the given vector. */ offset(offset: Vector): Plane; #private; }