LineSegment3d Class

A LineSegment3d is:

  • A 3d line segment represented by its start and end coordinates
    • startPoint
    • endPoint
  • The segment is parameterized with fraction 0 at the start and fraction 1 at the end, i.e. either of these equivalent forms to map fraction f to a point X(f)
    X(f)=P0+f∗(P1−P0)X(f)=(1−f)∗P0+f∗P0X(f) = P_0 + f * (P_1 - P_0)\newline
     X(f) = (1-f)*P_0  + f * P_0

Extends

Implements

Methods

Name Description
constructor(point0: Point3d, point1: Point3d): LineSegment3d Protected CAPTURE point references as a LineSegment3d  
announceClipIntervals(clipper: Clipper, announce?: AnnounceNumberNumberCurvePrimitive): boolean Find intervals of this curve primitive that are interior to a clipper  
appendPlaneIntersectionPoints(plane: PlaneAltitudeEvaluator, result: CurveLocationDetail[]): number Compute points of simple (transverse) with a plane.  
clone(): LineSegment3d Clone the LineSegment3d  
clonePartialCurve(fractionA: number, fractionB: number): undefined | CurvePrimitive Return (if possible) a curve primitive which is a portion of this curve.  
cloneTransformed(transform: Transform): CurvePrimitive Clone and apply transform to the clone.  
closestPoint(spacePoint: Point3d, extend: VariantCurveExtendParameter, result?: CurveLocationDetail): CurveLocationDetail Returns a curve location detail with both xyz and fractional coordinates of the closest point.  
computeStrokeCountForOptions(options?: StrokeOptions): number return the stroke count required for given options.  
curveLength(): number Return the length of the segment.  
curveLengthBetweenFractions(fraction0: number, fraction1: number): number Return the length of the partial segment between fractions.  
dispatchToGeometryHandler(handler: GeometryHandler): any Second step of double dispatch: call handler.handleLineSegment3d(this)  
emitStrokableParts(handler: IStrokeHandler, options?: StrokeOptions): void Emit strokes to caller-supplied handler  
emitStrokes(dest: LineString3d, options?: StrokeOptions): void Emit strokes to caller-supplied linestring  
endPoint(result?: Point3d): Point3d Return a (clone of) the end point.  
extendRange(range: Range3d, transform?: Transform): void Extend a range to include the (optionally transformed) line segment  
fractionToPoint(fraction: number, result?: Point3d): Point3d Return the point at fractional position along the line segment.  
fractionToPointAnd2Derivatives(fraction: number, result?: Plane3dByOriginAndVectors): Plane3dByOriginAndVectors Construct a plane with  
fractionToPointAndDerivative(fraction: number, result?: Ray3d): Ray3d Return the point and derivative vector at fractional position along the line segment.  
getFractionToDistanceScale(): undefined | number A simple line segment's fraction and distance are proportional.  
isAlmostEqual(other: GeometryQuery): boolean Near equality test with other.  
isInPlane(plane: PlaneAltitudeEvaluator): boolean Test if both endpoints are in a plane (within tolerance)  
isSameGeometryClass(other: GeometryQuery): boolean test if other is of class LineSegment3d  
quickLength(): number Return the length of the segment.  
reverseInPlace(): void swap the endpoint references.  
set(point0: Point3d, point1: Point3d): void Set the start and endpoints by cloning the input parameters.  
setFrom(other: LineSegment3d): void copy (clone) data from other  
setFromJSON(json?: any): void Construct a line from either of these json forms:  
setRefs(point0: Point3d, point1: Point3d): void Set the start and endpoints by capturing input references.  
startPoint(result?: Point3d): Point3d Return a (clone of) the start point.  
toJSON(): any Place the lineSegment3d start and points in a json object  
tryTransformInPlace(transform: Transform): boolean Transform the two endpoints of this LinSegment.  
create(point0: Point3d, point1: Point3d, result?: LineSegment3d): LineSegment3d Static Create with start and end points.  
createCapture(point0: Point3d, point1: Point3d): LineSegment3d Static Create with start and end points.  
createXYXY(x0: number, y0: number, x1: number, y1: number, z: number = 0, result?: LineSegment3d): LineSegment3d Static create a LineSegment3d from xy coordinates of start and end, with common z.  
createXYZXYZ(x0: number, y0: number, z0: number, x1: number, y1: number, z1: number, result?: LineSegment3d): LineSegment3d Static create a LineSegment3d from xy coordinates of start and end, with common z.  
fromJSON(json?: any): LineSegment3d Static Create a new LineSegment3d with coordinates from json object.  

Inherited methods

Name Inherited from Description
addMappedStrokesToLineString3D(map: StrokeCountMap, linestring: LineString3d): number CurvePrimitive * evaluate strokes at fractions indicated in a StrokeCountMap.
collectCurvePrimitives(collectorArray?: CurvePrimitive[], smallestPossiblePrimitives: boolean = false, explodeLinestrings: boolean = false): CurvePrimitive[] CurvePrimitive Return an array containing only the curve primitives.
collectCurvePrimitivesGo(collectorArray: CurvePrimitive[], _smallestPossiblePrimitives: boolean, _explodeLinestrings: boolean = false): void CurvePrimitive Return an array containing only the curve primitives.
computeAndAttachRecursiveStrokeCounts(options?: StrokeOptions, parentMap?: StrokeCountMap): void CurvePrimitive attach StrokeCountMap structure to this primitive (and recursively to any children)
curveLengthWithFixedIntervalCountQuadrature(fraction0: number, fraction1: number, numInterval: number, numGauss: number = 5): number CurvePrimitive * Run an integration (with a default gaussian quadrature) with a fixed fractional step
fractionAndDistanceToPointOnTangent(fraction: number, distance: number): Point3d CurvePrimitive Construct a point extrapolated along tangent at fraction.
fractionToCurvature(fraction: number): undefined | number CurvePrimitive Returns the (absolute) curvature magnitude.
fractionToFrenetFrame(fraction: number, result?: Transform): undefined | Transform CurvePrimitive Construct a frenet frame:
fractionToPointAndUnitTangent(fraction: number, result?: Ray3d): Ray3d CurvePrimitive Returns a ray whose origin is the curve point and direction is the unit tangent.
moveSignedDistanceFromFraction(startFraction: number, signedDistance: number, allowExtension: boolean, result?: CurveLocationDetail): CurveLocationDetail CurvePrimitive * (Attempt to) find a position on the curve at a signed distance from start fraction.
moveSignedDistanceFromFractionGeneric(startFraction: number, signedDistance: number, allowExtension: boolean, result?: CurveLocationDetail): CurveLocationDetail Protected CurvePrimitive Generic algorithm to search for point at signed distance from a fractional startPoint.
range(transform?: Transform, result?: Range3d): Range3d CurvePrimitive return the range of the entire (tree) GeometryQuery
tryTranslateInPlace(dx: number, dy: number = 0.0, dz: number = 0.0): boolean CurvePrimitive try to move the geometry by dx,dy,dz
areAlmostEqual(a: undefined | GeometryQuery, b: undefined | GeometryQuery): boolean Static CurvePrimitive apply instance method isAlmostEqual if both are defined.
installStrokeCountMap(curve: CurvePrimitive, curveMap: StrokeCountMap, parentMap?: StrokeCountMap): void Static CurvePrimitive final install step to save curveMap in curve.

Properties

Name Type Description
curvePrimitiveType Readonly "lineSegment" String name for schema properties  
isExtensibleFractionSpace Accessor ReadOnly boolean A LineSegment3d extends along its infinite line.  
point0Ref Accessor ReadOnly Point3d Return REFERENCE to the start point of this segment.  
point1Ref Accessor ReadOnly Point3d Return REFERENCE to the end point of this segment.  

Inherited properties

Name Type Inherited from Description
children Accessor ReadOnly undefined | GeometryQuery[] CurvePrimitive return GeometryQuery children for recursive queries.

* leaf classes do not need to implement.
geometryCategory Readonly "curvePrimitive" CurvePrimitive String name for schema properties
parent undefined | any CurvePrimitive data attached by various algorithms (e.g.
strokeData undefined | StrokeCountMap CurvePrimitive data attached during stroking for facets.

Defined in

Last Updated: 12 June, 2024