UNPKG

@bitbybit-dev/base

Version:

Bit By Bit Developers Base CAD Library to Program Geometry

159 lines (158 loc) 4.9 kB
import { GeometryHelper } from "./geometry-helper"; import * as Inputs from "../inputs"; import { Point } from "./point"; import { Vector } from "./vector"; /** * Contains various methods for lines and segments. Line in bitbybit is a simple object that has start and end point properties. * { start: [ x, y, z ], end: [ x, y, z ] } */ export declare class Line { private readonly vector; private readonly point; private readonly geometryHelper; constructor(vector: Vector, point: Point, geometryHelper: GeometryHelper); /** * Gets the start point of the line * @param inputs a line * @returns start point * @group get * @shortname line start point * @drawable true */ getStartPoint(inputs: Inputs.Line.LineDto): Inputs.Base.Point3; /** * Gets the end point of the line * @param inputs a line * @returns end point * @group get * @shortname line end point * @drawable true */ getEndPoint(inputs: Inputs.Line.LineDto): Inputs.Base.Point3; /** * Gets the length of the line * @param inputs a line * @returns line length * @group get * @shortname line length * @drawable false */ length(inputs: Inputs.Line.LineDto): number; /** * Reverse the endpoints of the line * @param inputs a line * @returns reversed line * @group operations * @shortname reversed line * @drawable true */ reverse(inputs: Inputs.Line.LineDto): Inputs.Base.Line3; /** * Transform the line * @param inputs a line * @returns transformed line * @group transforms * @shortname transform line * @drawable true */ transformLine(inputs: Inputs.Line.TransformLineDto): Inputs.Base.Line3; /** * Transforms the lines with multiple transform for each line * @param inputs lines * @returns transformed lines * @group transforms * @shortname transform lines * @drawable true */ transformsForLines(inputs: Inputs.Line.TransformsLinesDto): Inputs.Base.Line3[]; /** * Create the line * @param inputs start and end points of the line * @returns line * @group create * @shortname line * @drawable true */ create(inputs: Inputs.Line.LinePointsDto): Inputs.Base.Line3; /** * Create the segment * @param inputs start and end points of the segment * @returns segment * @group create * @shortname segment * @drawable true */ createSegment(inputs: Inputs.Line.LinePointsDto): Inputs.Base.Segment3; /** * Gets the point on the line segment at a given param * @param inputs line * @returns point on line * @group get * @shortname point on line * @drawable true */ getPointOnLine(inputs: Inputs.Line.PointOnLineDto): Inputs.Base.Point3; /** * Create the lines segments between all of the points in a list * @param inputs points * @returns lines * @group create * @shortname lines between points * @drawable true */ linesBetweenPoints(inputs: Inputs.Line.PointsLinesDto): Inputs.Base.Line3[]; /** * Create the lines between start and end points * @param inputs start points and end points * @returns lines * @group create * @shortname start and end points to lines * @drawable true */ linesBetweenStartAndEndPoints(inputs: Inputs.Line.LineStartEndPointsDto): Inputs.Base.Line3[]; /** * Convert the line to segment * @param inputs line * @returns segment * @group convert * @shortname line to segment * @drawable false */ lineToSegment(inputs: Inputs.Line.LineDto): Inputs.Base.Segment3; /** * Converts the lines to segments * @param inputs lines * @returns segments * @group convert * @shortname lines to segments * @drawable false */ linesToSegments(inputs: Inputs.Line.LinesDto): Inputs.Base.Segment3[]; /** * Converts the segment to line * @param inputs segment * @returns line * @group convert * @shortname segment to line * @drawable true */ segmentToLine(inputs: Inputs.Line.SegmentDto): Inputs.Base.Line3; /** * Converts the segments to lines * @param inputs segments * @returns lines * @group convert * @shortname segments to lines * @drawable true */ segmentsToLines(inputs: Inputs.Line.SegmentsDto): Inputs.Base.Line3[]; /** * If two lines intersect return the intersection point * @param inputs line1 and line2 * @returns intersection point or undefined if no intersection * @group intersection * @shortname line-line int * @drawable true */ lineLineIntersection(inputs: Inputs.Line.LineLineIntersectionDto): Inputs.Base.Point3 | undefined; }