Range2d Class

Range box in xy plane

Extends

Implements

  • object

Methods

Name Description
constructor(lowX: number = Range2d._EXTREME_POSITIVE, lowY: number = Range2d._EXTREME_POSITIVE, highX: number = Range2d._EXTREME_NEGATIVE, highY: number = Range2d._EXTREME_NEGATIVE): Range2d    
clone(result?: this): this return a clone of this range (or copy to optional result)  
containsPoint(point: XAndY): boolean Test if a point is within the range.  
containsRange(other: LowAndHighXY): 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.  
diagonal(result?: Vector2d): Vector2d return the diagonal vector.  
diagonalFractionToPoint(fraction: number, result?: Point2d): Point2d return the diagonal vector.  
distanceToPoint(point: XAndY): number Return 0 if the point is within the range, otherwise the distance to the closest face or corner  
distanceToRange(other: LowAndHighXY): number Return 0 if the point is within the range, otherwise the distance to the closest face or corner  
expandInPlace(delta: number): void move all limits by a fixed amount.  
extendPoint(point: XAndY): void Expand this range to include a point.  
extendRange(other: LowAndHighXY): void Expand this range to include a range.  
extendTransformedXY(transform: Transform, x: number, y: number): void Expand this range to include a point given by x,y  
extendXY(x: number, y: number): void Expand this range to include a point given by x,y  
fractionToPoint(fractionX: number, fractionY: number, result?: Point2d): Point2d return a point given by fractional positions on the XY axes.  
freeze(): void Freeze this instance (and its deep content) so it can be considered read-only  
intersect(other: LowAndHighXY, result?: Range2d): Range2d Return the intersection of ranges.  
intersectsRange(other: LowAndHighXY): boolean Test if there is any intersection with other range  
isAlmostEqual(other: Range2d): boolean Returns true if this and other have equal low and high parts, or both are null ranges.  
maxAbs(): number Largest absolute value among any coordinates in the box corners.  
scaleAboutCenterInPlace(scaleFactor: number): void move low and high points by scaleFactor around the center point.  
setFrom(other: LowAndHighXY): void copy all content from any other that has low and high xy data.  
setFromJSON(json: Range2dProps): void treat any array of numbers as numbers to be inserted !!!  
setNull(): void reset the low and high to null range state.  
setXY(x: number, y: number): void Set low and hight to a single xy value.  
toFloat64Array(): Float64Array Flatten the low and high coordinates of this instance into an array of 4 doubles  
toJSON(): Range2dProps return json array with two points as produced by Point2d.toJSON  
union(other: LowAndHighXY, result?: Range2d): Range2d Return the union of ranges.  
xLength(): number Length of the box in the x direction  
yLength(): number Length of the box in the y direction  
createArray<T extends Range2d>(points: Point2d[], result?: T): T extends Range2d Static Create a range around an array of points.  
createFrom<T extends Range2d>(other: LowAndHighXY, result?: T): T extends Range2d Static create a new Range2d from any other that has low and high xy data.  
createNull<T extends Range2d>(result?: T): T extends Range2d Static create a range with no content.  
createXY<T extends Range2d>(x: number, y: number, result?: T): T extends Range2d Static Create a single point box  
createXYXY<T extends Range2d>(xA: number, yA: number, xB: number, yB: number, result?: T): T extends Range2d Static Create a box with 2 pairs of xy candidates.  
createXYXYOrCorrectToNull<T extends Range2d>(xA: number, yA: number, xB: number, yB: number, result?: T): T extends Range2d Static Create a box with 2 pairs of xy candidates.  
fromArrayBuffer<T extends Range2d>(buffer: ArrayBuffer): T extends Range2d Static Construct a Range2d from an un-typed array.  
fromFloat64Array<T extends Range2d>(f64: Float64Array): T extends Range2d Static Construct a Range2d from an array of double-precision values  
fromJSON<T extends Range2d>(json?: Range2dProps): T extends Range2d Static Use setFromJSON to parse json into a new Range2d instance.  
isNull(range: LowAndHighXY): boolean Static Test if the box has high strictly less than low for any of x,y, condition.  
toFloat64Array(val: LowAndHighXY): 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 Point2d Return the midpoint of the diagonal.  
high Point2d low point coordinates.  
isAlmostZeroX Accessor ReadOnly boolean Test if the x direction size is nearly zero  
isAlmostZeroY Accessor ReadOnly boolean Test if the y direction size is nearly zero  
isNull Accessor ReadOnly boolean Test if the box has high<low for any of x,y, condition.  
isSinglePoint Accessor ReadOnly boolean Test of the range contains a single point.  
low Point2d 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  

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