Range3d Class

Axis aligned range in 3D.

  • member low contains minimum coordinate of range box
  • member high contains maximum coordinate of range box
  • The range is considered null (empty) if any low member is larger than its high counterpart.

Extends

Implements

Methods

Name Description
constructor(lowX: number = RangeBase._EXTREME_POSITIVE, lowY: number = RangeBase._EXTREME_POSITIVE, lowZ: number = RangeBase._EXTREME_POSITIVE, highX: number = RangeBase._EXTREME_NEGATIVE, highY: number = RangeBase._EXTREME_NEGATIVE, highZ: number = RangeBase._EXTREME_NEGATIVE): Range3d    
clone(result?: this): this Return a copy  
containsPoint(point: Point3d): boolean Test if a point is within the range.  
containsPointXY(point: Point3d): boolean Test if the x,y coordinates of a point are within the range.  
containsRange(other: Range3d): boolean Test of other range is within this range  
containsXY(x: number, y: number): boolean Test if a point given as x,y is within the range.  
containsXYZ(x: number, y: number, z: number): boolean Test if a point given as x,y,z is within the range.  
corners(): Point3d[] Return an array with the 8 corners on order wth "x varies fastest, then y, then z"  
diagonal(result?: Vector3d): Vector3d return the diagonal vector.  
diagonalFractionToPoint(fraction: number, result?: Point3d): Point3d Return the diagonal vector.  
distanceToPoint(point: XYAndZ): number Return 0 if the point is within the range, otherwise the distance to the closest face or corner  
distanceToRange(other: Range3d): number returns 0 if the ranges have any overlap, otherwise the shortest absolute distance from one to the other.  
ensureMinLengths(min: number = 0.001): void Ensure that the length of each dimension of this AxisAlignedBox3d is at least a minimum size.  
expandInPlace(delta: number): void move all limits by a fixed amount.  
extend(...point: Point3d[]): void Extend (modify in place) so that the range is large enough to include the supplied points.  
extendArray(points: Point3d[] | GrowableXYZArray, transform?: Transform): void extend a range around an array of points (optionally transformed)  
extendInverseTransformedArray(points: Point3d[] | GrowableXYZArray, transform: Transform): void extend a range around an array of points (optionally transformed)  
extendInverseTransformedXYZ(transform: Transform, x: number, y: number, z: number): boolean multiply the point x,y,z by transform and use the coordinate to extend this range.  
extendPoint(point: Point3d): void Expand this range to include a point.  
extendRange(other: LowAndHighXYZ): void Expand this range to include a range.  
extendTransformTransformedXYZ(transformA: Transform, transformB: Transform, x: number, y: number, z: number): void Extend the range by the two transforms applied to xyz  
extendTransformedPoint(transform: Transform, point: Point3d): void Expand this range to include a transformed point.  
extendTransformedXYZ(transform: Transform, x: number, y: number, z: number): void multiply the point x,y,z by transform and use the coordinate to extend this range.  
extendTransformedXYZW(transform: Transform, x: number, y: number, z: number, w: number): void multiply the point x,y,z,w by transform and use the coordinate to extend this range.  
extendXYZ(x: number, y: number, z: number): void Expand this range by distances a (possibly signed) in all directions  
extendXYZW(x: number, y: number, z: number, w: number): void Expand this range by distances a (weighted and possibly signed) in all directions  
fractionToPoint(fractionX: number, fractionY: number, fractionZ: number, result?: Point3d): Point3d Return a point given by fractional positions on the XYZ axes.  
freeze(): void Freeze this instance (and its deep content) so it can be considered read-only  
getLocalToWorldTransform(result?: Transform): Transform Create a local to world transform from this range.  
getNpcToWorldRangeTransform(result?: Transform): Transform Creates an NPC to world transformation to go from 000...111 to the globally aligned cube with diagonally opposite corners that are the
min and max of this range.
 
intersect(other: Range3d, result?: Range3d): Range3d Return the intersection of ranges.  
intersectsRange(other: Range3d): boolean Test if there is any intersection with other range  
intersectsRangeXY(other: Range3d): boolean Test if there is any intersection with other range  
isAlmostEqual(other: Range3d): boolean Returns true if this and other have equal low and high parts, or both are null ranges.  
localToWorld(xyz: XYAndZ, result?: Point3d): Point3d | undefined Return a point given by fractional positions on the XYZ axes.  
localToWorldArrayInPlace(points: Point3d[]): boolean Replace fractional coordinates by world coordinates.  
localXYZToWorld(fractionX: number, fractionY: number, fractionZ: number, result?: Point3d): Point3d | undefined Return a point given by fractional positions on the XYZ axes.  
maxAbs(): number Return the largest absolute value among any coordinates in the box corners.  
maxLength(): number Return the largest of the x,y, z lengths of the range.  
scaleAboutCenterInPlace(scaleFactor: number): void move low and high points by scaleFactor around the center point.  
setFrom(other: Range3d): void copy low and high values from other.  
setFromJSON(json?: Range3dProps): void set this range (in place) from json such as
key-value pairs: {low:[1,2,3], high:[4,5,6]}
array of points: [[1,2,3],[9,3,4],[-2,1,3] ...]
* Lowest level points can be [1,2,3] or {x:1,y:2,z:3}
 
setNull(): void Set this transform to values that indicate it has no geometric contents.  
setXYZ(x: number, y: number, z: number): void Set the range to be a single point supplied as x,y,z values  
toFloat64Array(): Float64Array Flatten the low and high coordinates of this into an array of 6 doubles  
toJSON(): Range3dProps Return a JSON object `{low: ...  
union(other: Range3d, result?: Range3d): Range3d Return the union of ranges.  
worldToLocal(point: Point3d, result?: Point3d): Point3d | undefined Return fractional coordinates of point within the range.  
worldToLocalArrayInPlace(point: Point3d[]): boolean Return fractional coordinates of point within the range.  
xLength(): number Return the length of the box in the x direction  
yLength(): number Return the length of the box in the y direction  
zLength(): number Return the length of the box in the z direction  
create(...point: Point3d[]): Range3d Static Return a range large enough to include the supplied points.  
createArray<T extends Range3d>(points: Point3d[], result?: T): T extends Range3d Static Create a range around an array of points.  
createFrom<T extends Range3d>(other: Range3d, result?: T): T extends Range3d Static Return a new Range3d copied from a range or derived type  
createFromVariantData(data: MultiLineStringDataVariant): Range3d Static Create a range from freely structured MultiLineStringDataVariant.  
createInverseTransformedArray<T extends Range3d>(transform: Transform, points: Point3d[] | GrowableXYZArray): T extends Range3d Static create a Range3d enclosing the points after inverse transform.  
createNull<T extends Range3d>(result?: T): T extends Range3d Static Return a range initialized to have no content.  
createRange2d<T extends Range3d>(range: Range2d, z: number = 0, result?: T): T extends Range3d Static Creates a 3d range from a 2d range's low and high members, setting the corresponding z values to the value given.  
createTransformed<T extends Range3d>(transform: Transform, ...point: Point3d[]): T extends Range3d Static create a Range3d enclosing the transformed points.  
createTransformedArray<T extends Range3d>(transform: Transform, points: Point3d[] | GrowableXYZArray): T extends Range3d Static create a Range3d enclosing the transformed points.  
createXYZ<T extends Range3d>(x: number, y: number, z: number, result?: T): T extends Range3d Static Create a single point range  
createXYZXYZ<T extends Range3d>(xA: number, yA: number, zA: number, xB: number, yB: number, zB: number, result?: T): T extends Range3d Static Create a box with 2 pairs of xyz candidates.  
createXYZXYZOrCorrectToNull<T extends Range3d>(xA: number, yA: number, zA: number, xB: number, yB: number, zB: number, result?: T): T extends Range3d Static Create a box with 2 pairs of xyz candidates.  
faceCornerIndices(index: number): number[] Static Return an array with indices of the corners of a face
face 0 has negative x normal
face 1 has positive x normal
face 2 has negative y normal
face 3 has positive y normal
face 4 has negative z normal
face 5 has positive z normal
Any other value returns face 5
faces are CCW as viewed from outside.
 
fromArrayBuffer<T extends Range3d>(buffer: ArrayBuffer): T extends Range3d Static Construct a Range3d from an un-typed array.  
fromFloat64Array<T extends Range3d>(f64: Float64Array): T extends Range3d Static Construct a Range3d from an array of double-precision values  
fromJSON<T extends Range3d>(json?: Range3dProps): T extends Range3d Static Use setFromJSON to parse json into a new Range3d instance.  
isNull(data: LowAndHighXYZ): boolean Static Test if data has high<low for any of x,y,z, condition.  
toFloat64Array(val: LowAndHighXYZ): Float64Array Static Flatten the low and high coordinates of any json object with low.x ..  

Inherited methods

Name Inherited from Description
coordinateToRangeAbsoluteDistance(x: number, low: number, high: number): number Static RangeBase Given a coordinate and pair of range limits, return the smallest distance to the range.
isExtremePoint2d(xy: Point2d): boolean Static RangeBase Return true if either of x,y is outside the range `[_EXTREME_NEGATIVE, _EXTREME_POSITIVE]'
isExtremePoint3d(xyz: Point3d): boolean Static RangeBase Return true if any x or y or z is outside the range `[_EXTREME_NEGATIVE, _EXTREME_POSITIVE]'
isExtremeValue(x: number): boolean Static RangeBase Return true if x is outside the range `[_EXTREME_NEGATIVE, _EXTREME_POSITIVE]'
npcScaleFactor(low: number, high: number): number ProtectedStatic RangeBase Return 0 if high<= low, otherwise 1/(high-low) for use in fractionalizing
rangeToRangeAbsoluteDistance(lowA: number, highA: number, lowB: number, highB: number): number Static RangeBase Return the min absolute distance from any point of [lowA,highA]' to any point of[lowB,highB]'.

Properties

Name Type Description
center Accessor ReadOnly Point3d Return the midpoint of the diagonal.  
high Point3d high point coordinates  
isAlmostZeroX Accessor ReadOnly boolean returns true if the x direction size is nearly zero  
isAlmostZeroY Accessor ReadOnly boolean returns true if the y direction size is nearly zero  
isAlmostZeroZ Accessor ReadOnly boolean returns true if the z direction size is nearly zero  
isNull Accessor ReadOnly boolean Test if the box has high<low for any of x,y,z, condition.  
isSinglePoint Accessor ReadOnly boolean Test of the range contains a single point.  
low Point3d low point coordinates  
xHigh Accessor ReadOnly number return the high x coordinate  
xLow Accessor ReadOnly number return the low x coordinate  
yHigh Accessor ReadOnly number return the high y coordinate  
yLow Accessor ReadOnly number return the low y coordinate  
zHigh Accessor ReadOnly number return the high z coordinate  
zLow Accessor ReadOnly number return the low z coordinate  

Inherited properties

Name Type Inherited from Description
_EXTREME_NEGATIVE ProtectedStatic number RangeBase Number considered to be impossibly negative for a coordinate in a range.
_EXTREME_POSITIVE ProtectedStatic number RangeBase Number considered impossibly large possibly for a coordinate in a range.

Defined in

Last Updated: 20 September, 2019