## 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.

### 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):
clone(result?: Range3d): Return a copy
cloneTranslated(shift: Readonly<WritableXYAndZ>, result?: Range3d): Return a copy, translated by adding shift components in all directions.
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(result?: Point3d[]): Point3d[] Return an array with the 8 corners on order wth "x varies fastest, then y, then z"
diagonal(result?: Vector3d): return the diagonal vector.
diagonalFractionToPoint(fraction: number, result?: Point3d): Return the diagonal vector.
distanceToPoint(point: Readonly<WritableXYAndZ>): 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 = .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)
extendInterpolated(xyz0: Point3d, fraction: number, xyz1: Point3d): void Expand this range by a point interpolated between given points.
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, transform?: Transform): void Expand this range to include a point.
extendRange(other: Readonly<WritableLowAndHighXYZ>): void Expand this range to include a range.
extendSingleAxis(a: number, axisIndex: AxisIndex): void Expand one component of this 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.
extendWhenLarger(other: Readonly<WritableLowAndHighXYZ>, extrapolationFactor: number): void In each direction look at the difference between this range limit and that of interiorRange.
extendXOnly(x: number): void Expand this range by distances a in only the x direction.
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
extendYOnly(y: number): void Expand this range by distances a in only the x direction.
extendZOnly(z: number): void Expand this range by distances a in only the x direction.
fractionToPoint(fractionX: number, fractionY: number, fractionZ: number = 0, result?: Point3d): Return a point given by fractional positions on the XYZ axes.
freeze(): Readonly<Range3d> Freeze this instance (and its members) so it is read-only
getLocalToWorldTransform(result?: Transform): Create a local to world transform from this range.
getNpcToWorldRangeTransform(result?: Transform): Creates an NPC to world transformation to go from 000...111 to the globally aligned cube with diagonally opposite corners that are the
intersect(other: Range3d, result?: 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: Readonly<Range3d>, tol?: number): boolean Returns true if this and other have equal low and high parts, or both are null ranges.
localToWorld(xyz: Readonly<WritableXYAndZ>, result?: Point3d): undefined | Point3d 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): undefined | Point3d 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.
rectangleXY(zFraction: number = 0.0, upwardNormal: boolean = true, addClosure: boolean = true): undefined | Point3d[] Return a rectangle that is the cross section as viewed from above (z direction) and at zFraction
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
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(): Return a JSON object {low: ...
union(other: Range3d, result?: Range3d): Return the union of ranges.
worldToLocal(point: Point3d, result?: Point3d): undefined | Point3d 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[]): Static Return a range large enough to include the supplied points.
createArray<T extends Range3d<T>>(points: Point3d[], result?: T): T Static Create a range around an array of points.
createFrom<T extends Range3d<T>>(other: Range3d, result?: T): T Static Return a new Range3d copied from a range or derived type
createFromVariantData(): Static Create a range from freely structured MultiLineStringDataVariant.
createInverseTransformedArray<T extends Range3d<T>>(transform: Transform, points: Point3d[] | GrowableXYZArray): T Static create a Range3d enclosing the points after inverse transform.
createNull<T extends Range3d<T>>(result?: T): T Static Return a range initialized to have no content.
createRange2d<T extends Range3d<T>>(range: Range2d, z: number = 0, result?: T): T 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<T>>(transform: Transform, ...point: Point3d[]): T Static create a Range3d enclosing the transformed points.
createTransformedArray<T extends Range3d<T>>(transform: Transform, points: Point3d[] | GrowableXYZArray): T Static create a Range3d enclosing the transformed points.
createXYZ<T extends Range3d<T>>(x: number, y: number, z: number, result?: T): T Static Create a single point range
createXYZXYZ<T extends Range3d<T>>(xA: number, yA: number, zA: number, xB: number, yB: number, zB: number, result?: T): T Static Create a box with 2 pairs of xyz candidates.
createXYZXYZOrCorrectToNull<T extends Range3d<T>>(xA: number, yA: number, zA: number, xB: number, yB: number, zB: number, result?: T): T 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
fromArrayBuffer<T extends Range3d<T>>(buffer: ArrayBuffer): T Static Construct a Range3d from an un-typed array.
fromFloat64Array<T extends Range3d<T>>(f64: Float64Array): T Static Construct a Range3d from an array of double-precision values
fromJSON<T extends Range3d<T>>(json?: Range3dProps): T Static Use setFromJSON to parse json into a new Range3d instance.
isNull(data: Readonly<WritableLowAndHighXYZ>): boolean Static Test if data has high<low for any of x,y,z, condition.
toFloat64Array(val: Readonly<WritableLowAndHighXYZ>): 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]'
multiplyIfPositive(q: number, factor: number, defaultValue: number = 0.0): number Static RangeBase if a > 0, return (extrapolationFactor * a); otherwise return defaultValue
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 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 ProtectedStaticReadonly number RangeBase Number considered to be impossibly negative for a coordinate in a range.
_EXTREME_POSITIVE ProtectedStaticReadonly number RangeBase Number considered impossibly large possibly for a coordinate in a range.

### Defined in

Last Updated: 27 March, 2023