Range1d Class

Range on a 1d axis

  • low and high members are always non-null objects
  • having low > high indicates an empty range.
  • the range contains x values for which low <= x <= high

Extends

Methods

Name Description
clipLinearMapToInterval(a: number, u: number, limitA: number, limitB: number): boolean clip this range to a linear half space condition
if limitA > limitB the limit space is empty
make this range null
return false;
otherwise (i.e limitA <= limitB)
solve `a + u f = limitA' and a + u * f = limitA
* if unable to solve (i.e.
 
clone(result?: this): this return a new Range1d with contents of this.  
containsRange(other: Range1d): boolean Test of other range is within this range  
containsX(x: number): boolean Test if a number is within the range.  
distanceToRange(other: Range1d): number returns 0 if the ranges have any overlap, otherwise the shortest absolute distance from one to the other.  
distanceToX(x: number): number Return 0 if the point is within the range, otherwise the (unsigned) distance to the closest face or corner  
expandInPlace(delta: number): void move all limits by a fixed amount.  
extendArray(values: Float64Array | number[]): void extend to include an array of values  
extendArraySubset(values: Float64Array | number[], beginIndex: number, numValue: number): void extend to include values at indices beginIndex <= i < endIndex]  
extendRange(other: Range1d): void Expand this range to include a range.  
extendX(x: number): void Expand this range by a single coordinate  
fractionToPoint(fraction: number): number return a point given by fractional positions within the range.  
intersect(other: Range1d, result?: Range1d): Range1d Return the intersection of ranges.  
intersectsRange(other: Range1d): boolean Test if there is any intersection with other range  
isAlmostEqual(other: Range1d): boolean Returns true if this and other have equal low and high parts, or both are null ranges.  
length(): number Return the length of the range in the x direction  
maxAbs(): number Return the largest absolute value among the box limits.  
scaleAboutCenterInPlace(scaleFactor: number): void move low and high points by scaleFactor around the center point.  
setFrom(other: Range1d): void copy contents from other Range1d.  
setFromJSON(json: Range1dProps): void Convert from a JSON object of one of these forms:

Any array of numbers: [value,value, value]
An object with low and high as properties: {low:lowValue, high: highValue}
 
setNull(): void reset the low and high to null range state.  
setX(x: number): void Set this range to be a single value.  
toJSON(): Range1dProps Convert to a JSON object of form
<br> [lowValue,highValue]<br>
 
union(other: Range1d, result?: Range1d): Range1d Return the intersection of ranges.  
createArray<T extends Range1d>(values: Float64Array | number[], result?: T): T extends Range1d Static Create a range containing all the values in an array.  
createFrom<T extends Range1d>(other: T extends Range1d, result?: T): T Static return a new Range1d with contents of this.  
createNull<T extends Range1d>(result?: T): T extends Range1d Static Create a range with no content.  
createX<T extends Range1d>(x: number, result?: T): T extends Range1d Static Create a single point box  
createXX<T extends Range1d>(xA: number, xB: number, result?: T): T extends Range1d Static Create a box from two values.  
createXXOrCorrectToNull<T extends Range1d>(xA: number, xB: number, result?: T): T extends Range1d Static Create a box from two values, but null range if the values are reversed  
fromJSON<T extends Range1d>(json?: Range1dProps): T extends Range1d Static Use setFromJSON to parse json into a new Range1d instance.  

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
high number high point coordinates.  
isAlmostZeroLength Accessor ReadOnly boolean Test if the x direction size is nearly zero  
isNull Accessor ReadOnly boolean Test if the box has high<low Note that a range around a single point is NOT null.  
isSinglePoint Accessor ReadOnly boolean Test of the range contains a single point.  
low number low point coordinates.  

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