UNPKG

@achirita/blox

Version:

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

74 lines (73 loc) 2.85 kB
import { Vertex } from './index'; import { Vector } from '../math'; export class Edge { static TYPE: Readonly<{ Line: "Line"; Circle: "Circle"; Ellipse: "Ellipse"; Hyperbola: "Hyperbola"; Parabola: "Parabola"; BezierCurve: "BezierCurve"; BSplineCurve: "BSplineCurve"; OffsetCurve: "OffsetCurve"; OtherCurve: "OtherCurve"; }>; constructor(wrapped: any); /** * Returns the wrapped OpenCascade object. * @private */ private get wrapped(); /** * Retrieves all vertices of the edge. * @returns {Vertex[]} An array of `Vertex` objects representing the vertices of the edge. */ get vertices(): Vertex[]; /** * Calculates the length of the edge. * @returns {number} The length of the edge. */ get length(): number; /** * Determines the type of the edge's curve. * @returns {string} The type of the edge (e.g., "Line", "Circle"). */ get type(): string; /** * Retrieves the point at a specified normalized distance along the edge. * @param {number} value - The normalized distance along the edge (between 0 and 1). * @returns {Vector} A `Vector` object representing the point at the given distance. */ pointAt(value: number): Vector; /** * Retrieves the point at a specified distance along the edge. * @param {number} value - The distance along the edge (between 0 and edge.length()). * @returns {Vector} A `Vector` object representing the point at the given distance. */ pointAtLength(value: number): Vector; /** * Retrieves the tangent vector at a specified normalized distance along the edge. * @param {number} value - The normalized distance along the edge (between 0 and 1). * @returns {Vector} A `Vector` object representing the tangent vector at the given distance. */ tangentAt(value: number): Vector; /** * Checks if the edge is parallel to a given direction vector. Only applicable for line edges. * @param {Vector} direction - The direction vector. * @returns {boolean|undefined} `true` if the edge is parallel to the direction, `false` otherwise, or `undefined` if not a line. */ isParallel(direction: Vector): boolean | undefined; /** * Checks if the edge is perpendicular to a given direction vector. Only applicable for line edges. * @param {Vector} direction - The direction vector. * @returns {boolean|undefined} `true` if the edge is perpendicular to the direction, `false` otherwise, or `undefined` if not a line. */ isPerpendicular(direction: Vector): boolean | undefined; /** * Computes the hash code for the solid. * @returns {number} The hash code. * @private */ private hashCode; #private; }