FrameBuilder Class

Helper class to accumulate points and vectors until there is enough data to define a coordinate system.

  • For the common case of building a right handed frame:
    • create the FrameBuilder and make calls to announcePoint and announceVector.
    • the frame will be fully determined by an origin and two vectors.
    • the first call to announcePoint will set the origin.
    • additional calls to announcePoint will produce announceVector call with the vector from the origin.
    • After each announcement, call getValidatedFrame(false)
    • getValidatedFrame will succeed when it has two independent vectors.
  • to build a left handed frame,
  • an origin and 3 independent vectors are required.
  • announce as above, but query with getValidatedFrame (true).
  • this will use the third vector to select right or left handed frame.

Methods

Name Description
constructor(): FrameBuilder    
announce(data: any): void Inspect the content of the data.  
announcePoint(point: Point3d): number announce a new point.  
announceVector(vector: Vector3d): number announce a new vector.  
applyDefaultUpVector(vector?: Vector3d): void If vector0 is known but vector1 is not, make vector1 the cross of the up-vector and vector0  
clear(): void clear all accumulated point and vector data  
getValidatedFrame(allowLeftHanded: boolean = false): undefined | Transform Try to assemble the data into a non-singular transform.  
savedVectorCount(): number Return the number of vectors saved.  
createFrameToDistantPoints(points: Point3d[]): undefined | Transform Static try to create a frame whose xy plane is through points.  
createFrameWithCCWPolygon(points: Point3d[]): undefined | Transform Static try to create a frame whose xy plane is through points, with the points appearing CCW in the local frame.  
createLocalToWorldTransformInRange(range: Range3d, scaleSelect: AxisScaleSelect = AxisScaleSelect.NonUniformRangeContainment, fractionX: number = 0, fractionY: number = 0, fractionZ: number = 0, defaultAxisLength: number = 1.0): Transform Static Create the localToWorld transform from a range to axes of its parent coordinate system.  
createRightHandedFrame(defaultUpVector: undefined | Vector3d, ...params: any[]): undefined | Transform Static create a localToWorld frame for the given data.  
createRightHandedLocalToWorld(...params: any[]): undefined | Transform Static create a transform containing points or vectors in the given data.  

Properties

Name Type Description
hasOrigin Accessor ReadOnly boolean Ask if there is a defined origin for the evolving frame  

Defined in

Last Updated: 11 June, 2024