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. each of these equivalent forms maps fraction f to a point X(f):
    X(f)=P0+f(P1P0)X(f)=(1f)P0+fP1X(f) = P_0 + f*(P_1 - P_0)\newline
     X(f) = (1-f)*P_0 + f*P_1

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): LineSegment3d Return (if possible) a curve primitive which is a portion of this curve.  
cloneTransformed(transform: Transform): LineSegment3d 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.  
constructOffsetXY(offsetDistanceOrOptions: number | OffsetOptions): undefined | CurvePrimitive | CurvePrimitive[] Construct an offset of the instance curve as viewed in the xy-plane (ignoring z).  
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 (This is NOT a reference to the stored 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  
projectedParameterRange(ray: Vector3d | Ray3d, lowHigh?: Range1d): undefined | Range1d Project instance geometry (via dispatch) onto the given ray, and return the extreme fractional parameters of  
quickLength(): number Return the length of the segment.  
rangeBetweenFractions(fraction0: number, fraction1: number, transform?: Transform): Range3d Returns a (high accuracy) range of the curve between fractional positions  
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 (This is NOT a reference to the stored 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.  
closestApproach(segmentA: LineSegment3d, extendA: VariantCurveExtendParameter, segmentB: LineSegment3d, extendB: VariantCurveExtendParameter, result?: CurveLocationDetailPair): undefined | CurveLocationDetailPair Static Compute the closest approach between a pair of line segments.  
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: number0, 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 Inherited CurvePrimitive Evaluate strokes at fractions indicated in a StrokeCountMap.
collectCurvePrimitives(collectorArray?: CurvePrimitive[], smallestPossiblePrimitives: booleanfalse, explodeLinestrings: booleanfalse): CurvePrimitive[] Inherited CurvePrimitive Return an array containing only the curve primitives.
collectCurvePrimitivesGo(collectorArray: CurvePrimitive[], _smallestPossiblePrimitives: boolean, _explodeLinestrings: booleanfalse): void Inherited CurvePrimitive Return an array containing only the curve primitives.
computeAndAttachRecursiveStrokeCounts(options?: StrokeOptions, parentMap?: StrokeCountMap): void Inherited CurvePrimitive Attach StrokeCountMap structure to this primitive (and recursively to any children)
curveLengthWithFixedIntervalCountQuadrature(fraction0: number, fraction1: number, numInterval: number, numGauss: number5): number Inherited CurvePrimitive Run an integration (with a default Gaussian quadrature) with a fixed fractional step
fractionAndDistanceToPointOnTangent(fraction: number, distance: number): Point3d Inherited CurvePrimitive Construct a point extrapolated along tangent at fraction.
fractionToCurvature(fraction: number): undefined | number Inherited CurvePrimitive Returns the (absolute) curvature magnitude.
fractionToFrenetFrame(fraction: number, result?: Transform): undefined | Transform Inherited CurvePrimitive Construct a frenet frame:
fractionToPointAndUnitTangent(fraction: number, result?: Ray3d): Ray3d Inherited CurvePrimitive Returns a ray whose origin is the curve point and direction is the unit tangent.
fractionToSignedXYRadiusOfCurvature(fraction: number): number Inherited CurvePrimitive Construct signed distance from a point on the planar curve to its center of curvature (in xy only).
moveSignedDistanceFromFraction(startFraction: number, signedDistance: number, allowExtension: boolean, result?: CurveLocationDetail): CurveLocationDetail Inherited 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 Inherited CurvePrimitive Generic algorithm to search for point at signed distance from a fractional startPoint.
range(transform?: Transform, result?: Range3d): Range3d Inherited CurvePrimitive Return the range of the entire GeometryQuery tree.
rangeBetweenFractionsByClone(fraction0: number, fraction1: number, transform?: Transform): Range3d Inherited CurvePrimitive Returns a (high accuracy) range of the curve between fractional positions
rangeBetweenFractionsByCount(fraction0: number, fraction1: number, count: number, transform?: Transform, extrapolationFactor: number0.0): Range3d Inherited CurvePrimitive Returns an approximate range based on a fixed number of evaluations
tryTranslateInPlace(dx: number, dy: number0.0, dz: number0.0): boolean Inherited CurvePrimitive Try to move the geometry by dx,dy,dz.
areAlmostEqual(a: GeometryQuery, b: GeometryQuery): boolean Static Inherited CurvePrimitive Apply instance method isAlmostEqual if both are defined.
installStrokeCountMap(curve: CurvePrimitive, curveMap: StrokeCountMap, parentMap?: StrokeCountMap): void Static Inherited 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 Inherited ReadOnly undefined | GeometryQuery[] CurvePrimitive Return GeometryQuery children for recursive queries.
* leaf classes do not need to implement.
geometryCategory Readonly Inherited "curvePrimitive" CurvePrimitive String name for schema properties
parent Inherited any | undefined CurvePrimitive Data attached by various algorithms (e.g.
strokeData Inherited StrokeCountMap | undefined CurvePrimitive Data attached during stroking for facets.

Defined in

Last Updated: 23 November, 2024