A 2d low and high corner pair for range boxes. More...
#include <drange2d.h>
Public Member Functions  
void  Init () 
Initializes a range cube with (inverted) large positive and negative values. More...  
void  InitFrom (DPoint2dCR point) 
Initializes the range to contain the single given point. More...  
void  Extend (DPoint2dCR point) 
Extends the coordinates of the range cube points in pRange so as to include the single additional point point. More...  
void  Extend (DPoint3dCR point) 
Extends the coordinates of the range cube points in pRange so as to include the single additional point point. More...  
void  InitFrom (double x, double y) 
Initialize the range from a single point given by components. More...  
void  Extend (double x, double y) 
extends the coordinates of the range cube points in pRange so as to include the single additional point at x,y. More...  
void  Extend (DPoint4dCR point4d) 
extends the coordinates of the range cube points in pRange so as to include the (normalized image of) the xy projection of the 4D point. More...  
void  InitFrom (DPoint2dCR point0, DPoint2dCR point1) 
Initializes the range to contain the two given points. More...  
void  InitFrom (double x0, double y0, double x1, double y1) 
Initializes the range to contain two points given as components. More...  
void  InitFrom (DPoint2dCR point0, DPoint2dCR point1, DPoint2dCR point2) 
Initialize the range to contain the three given points. More...  
void  InitFromUnitArcSweep (double theta0, double sweep) 
Initialize the range from an arc of the unit circle. More...  
void  InitFrom (DPoint2dCP point, int n) 
Initializes the range to contain the range of the given array of points. More...  
void  Extend (DPoint2dCP array, int n) 
extends the coordinates of the range cube points in pRange so as to include range of an array of points. More...  
void  InitFrom (DPoint3dCP point, int n) 
Initializes the range to contain the range of the xy parts of the array of 3D points. More...  
void  Extend (double extend) 
Extend each axis by the given distance on both ends of the range. More...  
void  Extend (DRange2dCR rangeB) 
extends the coordinates of the range cube points to include the range cube range1P. More...  
bool  IntersectionOf (DRange2dR range1, DRange2dR range2) 
Compute the intersection of two ranges and test if it is nonempty. More...  
void  UnionOf (DRange2dCR range1, DRange2dCR range2) 
Form the union of two ranges. More...  
void  RestrictToMinMax (DRange2dCR range0, DRange2dCR minMax) 
Returns a range which is the intersection of two ranges. More...  
bool  IsNull () const 
Check if the range is exactly the same as the null ranges returned by bsiDRange2d_init. More...  
double  ExtentSquared () const 
double  IntersectionExtentSquared (DRange2dCR range2) const 
Compute the intersection of given range with another range and return the extentSquared of the intersection range. More...  
bool  IsEmpty () const 
Test if high component is (strictly) less than low in any direction. More...  
bool  IsPoint () const 
double  Area () const 
returns product of axis extents. No test for zero or negative axes. More...  
double  LargestCoordinate () const 
double  XLength () const 
Returns difference of high and low in x direction – 0 if high < low. More...  
double  YLength () const 
Returns difference of high and low in y direction – 0 if high < low. More...  
void  Get4Lines (DPoint2dP originArray, DPoint2dP normalArray) const 
Extract the 4 bounding lines for a range rectangle, in origin normal form. More...  
void  Get4Corners (DPoint2dP box) const 
Generates a 4 point box around around a range cube. More...  
int  IndexOfMaximalAxis () const 
Return the index of the axis with largest absolute range. More...  
bool  IntersectRay (double ¶m0, double ¶m1, DPoint2dR point0, DPoint2dR point1, DPoint2dCR start, DPoint2dCR direction) const 
Compute the intersection of a range cube and a ray. More...  
bool  IsEqual (DRange2dCR range1) const 
Test if two ranges are exactly equal. More...  
bool  IsEqual (DRange2dCR range1, double tolerance) const 
Test if two ranges are equal within a tolerance applied componentwise. More...  
bool  TryFractionsToRangePoint (DPoint2dCR fractions, DPoint2dR xy) const 
map a fractional point to the range coordinates. More...  
bool  TryRangePointToFractions (DPoint2dCR xy, DPoint2dR fractions) const 
map a range point to the fractional coordinates. More...  
bool  IsContained (DRange2dCR outerRange) const 
Test if the given range is a (possible improper) subset of outerRange. More...  
bool  Contains (DPoint3dCR point) const 
Test if a point is contained in a range. More...  
bool  Contains (DPoint2dCR point) const 
Test if a point is contained in a range. More...  
bool  Contains (double x, double y) const 
Test if a point given as x,y,z is contained in a range. More...  
bool  IntersectsWith (DRange2dCR range2) const 
Test if two ranges have strictly nonnull overlap (intersection) More...  
bool  MoveChangesIntersection (DRange2dCR newRange, DRange2dCR outerRange) const 
Test if a modification of the given (instance) range would have a different touching relationship with outerRange. More...  
Static Public Member Functions  
static DRange2d  NullRange () 
Initializes a range cube with (inverted) large positive and negative values. More...  
static DRange2d  From (DPoint2dCR point) 
Initializes the range to contain the single given point. More...  
static DRange2d  From (DRange3dCR range) 
Remove z part of DRange3d. More...  
static DRange2d  From (bvector< DPoint3d > const &point) 
Return the range of an array. More...  
static DRange2d  From (double x, double y) 
Initialize the range from a single point given by components. More...  
static DRange2d  From (DPoint2dCR point0, DPoint2dCR point1) 
Initializes the range to contain the two given points. More...  
static DRange2d  From (double x0, double y0, double x1, double y1) 
Initializes the range to contain two points given as components. More...  
static DRange2d  From (DPoint2dCR point0, DPoint2dCR point1, DPoint2dCR point2) 
Initialize the range to contain the three given points. More...  
static DRange2d  FromUnitArcSweep (double theta0, double sweep) 
Initialize the range from an arc of the unit circle. More...  
static DRange2d  From (DPoint2dCP point, int n) 
Initializes the range to contain the range of the given array of points. More...  
static DRange2d  From (bvector< DPoint2d > const &points) 
Initializes the range to contain the range of the given array of points. More...  
static DRange2d  From (DPoint3dCP point, int n) 
Initializes the range to contain the range of the xy parts of the array of 3D points. More...  
Public Attributes  
DPoint2d  low 
low point of box More...  
DPoint2d  high 
high point of box More...  
A 2d low and high corner pair for range boxes.
The low and high members (points) are public, but should only be accessed for reading.
double Area  (  )  const 
returns product of axis extents. No test for zero or negative axes.
bool Contains  (  DPoint3dCR  point  )  const 
Test if a point is contained in a range.
[in]  point  point to test. (z is ignored) 
bool Contains  (  DPoint2dCR  point  )  const 
Test if a point is contained in a range.
[in]  point  point to test. (z is ignored) 
bool Contains  (  double  x, 
double  y  
)  const 
Test if a point given as x,y,z is contained in a range.
[in]  x  x coordinate 
[in]  y  y coordinate 
void Extend  (  DPoint2dCR  point  ) 
Extends the coordinates of the range cube points in pRange so as to include the single additional point point.
[in]  point  new point to be included in the range. 
void Extend  (  DPoint3dCR  point  ) 
Extends the coordinates of the range cube points in pRange so as to include the single additional point point.
[in]  point  new point to be included in the range. 
void Extend  (  double  x, 
double  y  
) 
extends the coordinates of the range cube points in pRange so as to include the single additional point at x,y.
[in]  x  extended range coordinate 
[in]  y  extended range coordinate 
void Extend  (  DPoint4dCR  point4d  ) 
extends the coordinates of the range cube points in pRange so as to include the (normalized image of) the xy projection of the 4D point.
[in]  point4d  new point to be included in minmax ranges 
void Extend  (  DPoint2dCP  array, 
int  n  
) 
extends the coordinates of the range cube points in pRange so as to include range of an array of points.
[in]  array  new points to be included in minmax ranges 
[in]  n  number of points 
void Extend  (  double  extend  ) 
Extend each axis by the given distance on both ends of the range.
[in]  extend  distance to extend 
void Extend  (  DRange2dCR  rangeB  ) 
extends the coordinates of the range cube points to include the range cube range1P.
[in]  rangeB  second range 
double ExtentSquared  (  )  const 

static 
Initializes the range to contain the single given point.

static 
Initialize the range from a single point given by components.
[in]  x  x coordinate 
[in]  y  y coordinate 

static 
Initializes the range to contain the two given points.
[in]  point0  first point 
[in]  point1  second point 

static 
Initializes the range to contain two points given as components.
Minmax logic is applied to the given points.
[in]  x0  first x 
[in]  y0  first y 
[in]  x1  second x 
[in]  y1  second y 

static 
Initialize the range to contain the three given points.
[in]  point0  first point 
[in]  point1  second point 
[in]  point2  third point 

static 
Initializes the range to contain the range of the given array of points.
If there are no points in the array, the range is initialized by
[in]  point  array of points to search 
[in]  n  number of points in array 
Initializes the range to contain the range of the given array of points.
If there are no points in the array, the range is initialized by DRange2d.init()
[in]  points  coordinates 

static 
Initializes the range to contain the range of the xy parts of the array of 3D points.
[in]  point  array of points to search 
[in]  n  number of points in array 

static 
Initialize the range from an arc of the unit circle.
[in]  theta0  start angle 
[in]  sweep  angular sweep 
void Get4Corners  (  DPoint2dP  box  )  const 
Generates a 4 point box around around a range cube.
Point ordering is by "x varies fastest" — 00, 10, 01, 11 for the unit range.
[out]  box  array of 4 points of the box 
void Get4Lines  (  DPoint2dP  originArray, 
DPoint2dP  normalArray  
)  const 
Extract the 4 bounding lines for a range rectangle, in origin normal form.
[out]  originArray  array of line origins 
[out]  normalArray  array of plane normals. Directions down, left, right, up. 
int IndexOfMaximalAxis  (  )  const 
Return the index of the axis with largest absolute range.
void Init  (  ) 
Initializes a range cube with (inverted) large positive and negative values.
void InitFrom  (  DPoint2dCR  point  ) 
Initializes the range to contain the single given point.
void InitFrom  (  double  x, 
double  y  
) 
Initialize the range from a single point given by components.
[in]  x  x coordinate 
[in]  y  y coordinate 
void InitFrom  (  DPoint2dCR  point0, 
DPoint2dCR  point1  
) 
Initializes the range to contain the two given points.
[in]  point0  first point 
[in]  point1  second point 
void InitFrom  (  double  x0, 
double  y0,  
double  x1,  
double  y1  
) 
Initializes the range to contain two points given as components.
Minmax logic is applied to the given points.
[in]  x0  first x 
[in]  y0  first y 
[in]  x1  second x 
[in]  y1  second y 
void InitFrom  (  DPoint2dCR  point0, 
DPoint2dCR  point1,  
DPoint2dCR  point2  
) 
Initialize the range to contain the three given points.
[in]  point0  first point 
[in]  point1  second point 
[in]  point2  third point 
void InitFrom  (  DPoint2dCP  point, 
int  n  
) 
Initializes the range to contain the range of the given array of points.
If there are no points in the array, the range is initialized by
[in]  point  array of points to search 
[in]  n  number of points in array 
void InitFrom  (  DPoint3dCP  point, 
int  n  
) 
Initializes the range to contain the range of the xy parts of the array of 3D points.
[in]  point  array of points to search 
[in]  n  number of points in array 
void InitFromUnitArcSweep  (  double  theta0, 
double  sweep  
) 
Initialize the range from an arc of the unit circle.
[in]  theta0  start angle 
[in]  sweep  angular sweep 
double IntersectionExtentSquared  (  DRange2dCR  range2  )  const 
Compute the intersection of given range with another range and return the extentSquared of the intersection range.
[in]  range2  second range 
bool IntersectionOf  (  DRange2dR  range1, 
DRange2dR  range2  
) 
Compute the intersection of two ranges and test if it is nonempty.
If empty (non overlap), result range null range.
[in]  range1  first range 
[in]  range2  second range 
bool IntersectRay  (  double &  param0, 
double &  param1,  
DPoint2dR  point0,  
DPoint2dR  point1,  
DPoint2dCR  start,  
DPoint2dCR  direction  
)  const 
Compute the intersection of a range cube and a ray.
If there is not a finite intersection, both params are set to 0 and and both points to point0.
[out]  param0  ray parameter where cube is entered 
[out]  param1  ray parameter where cube is left 
[out]  point0  entry point 
[out]  point1  exit point 
[in]  start  start point of ray 
[in]  direction  direction of ray 
bool IntersectsWith  (  DRange2dCR  range2  )  const 
Test if two ranges have strictly nonnull overlap (intersection)
[in]  range2  second range 
bool IsContained  (  DRange2dCR  outerRange  )  const 
Test if the given range is a (possible improper) subset of outerRange.
[in]  outerRange  outer range 
bool IsEmpty  (  )  const 
Test if high component is (strictly) less than low in any direction.
Note that equal components do not indicate empty. returns true if any low component is less than the corresponding high component
bool IsEqual  (  DRange2dCR  range1  )  const 
Test if two ranges are exactly equal.
[in]  range1  second range 
bool IsEqual  (  DRange2dCR  range1, 
double  tolerance  
)  const 
Test if two ranges are equal within a tolerance applied componentwise.
[in]  range1  second range 
[in]  tolerance  toleranc to be applied to each component 
bool IsNull  (  )  const 
Check if the range is exactly the same as the null ranges returned by bsiDRange2d_init.
(Note that ranges with other values with low > high are not necessarily null by this condition.)
bool IsPoint  (  )  const 
double LargestCoordinate  (  )  const 
bool MoveChangesIntersection  (  DRange2dCR  newRange, 
DRange2dCR  outerRange  
)  const 
Test if a modification of the given (instance) range would have a different touching relationship with outerRange.
[in]  newRange  candidate for modified range relationship. 
[in]  outerRange  containing range 

static 
Initializes a range cube with (inverted) large positive and negative values.
void RestrictToMinMax  (  DRange2dCR  range0, 
DRange2dCR  minMax  
) 
Returns a range which is the intersection of two ranges.
The first range is treated as a signed range, i.e. decreasing values from low to high are a nonempty range, and the output will maintain the direction. In a direction where there is no overlap, pRange high and low values are identical and are at the limit of pRange1 that is nearer to the values in range0. (Intended use: range0 is the 'actual' stroking range of a surface i.e. may go 'backwards'. pRange1 is the nominal full surface range, i.e. is known a priori to be 'forwards'. The clipping restricts unreliable range0 to the nominal surface range pRange1. range0 and pRange may be the same address. minMax must be different.
[in]  range0  range to be restricted 
[in]  minMax  allowable minmax range. Assumed to have low < high 
bool TryFractionsToRangePoint  (  DPoint2dCR  fractions, 
DPoint2dR  xy  
)  const 
map a fractional point to the range coordinates.
(0,0) is low point, (1,1) is high point.
[in]  fractions  fractional coordinates 
[out]  xy  computed coordinates. 
bool TryRangePointToFractions  (  DPoint2dCR  xy, 
DPoint2dR  fractions  
)  const 
map a range point to the fractional coordinates.
(0,0) is low point, (1,1) is high point.
[out]  fractions  fractional coordinates 
[in]  xy  computed coordinates. 
void UnionOf  (  DRange2dCR  range1, 
DRange2dCR  range2  
) 
Form the union of two ranges.
[in]  range1  first range. 
[in]  range2  second range. 
double XLength  (  )  const 
Returns difference of high and low in x direction – 0 if high < low.
double YLength  (  )  const 
Returns difference of high and low in y direction – 0 if high < low.
DPoint2d high 
high point of box
Referenced by RTree2dVal::ToRange().
DPoint2d low 
low point of box
Referenced by RTree2dVal::ToRange().