Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
DRange3d Struct Reference

A 3d low and high corner pair for range boxes. More...

#include <drange3d.h>

Public Member Functions

void Init ()
 Initializes a range cube with (inverted) large positive and negative values. More...
 
void InitFrom (DPoint3dCR point)
 Initializes the range to contain the single given 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 Extend (DPoint3dCR point, double weight)
 Extends the coordinates of the range cube points in pRange so as to include the single additional weighted point. More...
 
void InitFrom (DPoint3dCR point0, DPoint3dCR point1)
 Initializes the range to contain the two given points. More...
 
void InitFrom (double x, double y, double z)
 Initialize the range from a single point given by components. More...
 
void Extend (double x, double y, double z)
 Extends the coordinates of the range cube points in pRange so as to include the single additional point at x,y,z. More...
 
void InitFrom (double x0, double y0, double z0, double x1, double y1, double z1)
 Initializes the range to contain two points given as components. More...
 
void InitFrom (DPoint3dCR point0, DPoint3dCR point1, DPoint3dCR point2)
 Initializes a range to contain three given points. More...
 
void InitFromMinMax (double v0, double v1)
 Initialize the range from given min and max in all directions. More...
 
void InitFrom (DPoint3dCP point, int n)
 Initizlizes the range to contain the range of the given array of points. More...
 
void Extend (DPoint3dCP 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 (bvector< DPoint3d > const &points)
 Initialize a range to include points. More...
 
void Extend (bvector< DPoint3d > const &points)
 Expand a range to include points. More...
 
void Extend (TransformCR transform, DPoint3dCP points, int n)
 extends the coordinates of the range cube by transformed points More...
 
void Extend (TransformCR transform, DPoint3dCP points, double const *weights, int n)
 extends the coordinates of the range cube by transformed points More...
 
void InitFrom (TransformCR transform, bvector< DPoint3d > const &points)
 Initialize a range to include transformed points. More...
 
void Extend (TransformCR transform, bvector< DPoint3d > const &points)
 Expand a range to include transformed points. More...
 
void Extend (TransformCR transform, bvector< DPoint4d > const &points)
 Expand a range to include transformed points. More...
 
void InitFrom (DPoint3dCP point, const double *pWeight, int n)
 Initizlizes the range to contain the range of the given array of points. More...
 
void InitFrom (bvector< DPoint3d > const &points, bvector< double > const *weights)
 Initialize a range to include points with optional weights. More...
 
void Extend (bvector< DPoint3d > const &points, bvector< double > const *weights)
 Expand a range to include points with optional weights. More...
 
void Extend (DPoint4dCR point4d)
 extends the coordinates of the range cube points in pRange so as to include the (normalized image of) the given 4D point. More...
 
void Extend (DPoint4dCP point4d, int numPoint)
 extends the coordinates of the range cube points in pRange so as to include the (normalized image of the) array of DPoint4d More...
 
void InitFrom (bvector< DPoint4d > const &points)
 Initialize a range to include points. More...
 
void Extend (bvector< DPoint4d > const &points)
 Expand a range to include points. More...
 
void InitFrom (DPoint2dCP point, int n, double zVal)
 Initializes the range to contain the range of the given array of 2D points, with a single given z value for both the min and max points. More...
 
void InitFrom (bvector< DPoint2d > const &points, double zValue)
 Initialize a range to include points with fixed z. More...
 
void Extend (bvector< DPoint2d > const &points, double zValue)
 Expand a range to include points with fixed z. More...
 
void Extend (double extend)
 Extend each axis by the given distance on both ends of the range. More...
 
void ExtendBySweep (DVec3dCR vector)
 Extend either low or high of each axis by corresponding vector entry for sweep of the range cube. More...
 
void Extend (DRange3dCR range1)
 extends the coordinates of the range cube points to include the range cube range1P. More...
 
void Extend (DEllipse3dCR ellipse)
 extends the coordinates of the range cube points to include an ellipse More...
 
void UnionOf (DRange3dCR range0, DRange3dCR range1)
 returns the union of two ranges. More...
 
void IntersectionOf (DRange3dCR range1, DRange3dCR range2)
 Compute the intersection of two ranges. More...
 
void IntersectIndependentComponentsOf (DRange3dCR range1, DRange3dCR range2)
 Compute intersection of x,y,z components independently. More...
 
void ScaleAboutCenter (DRange3dCR rangeIn, double scale)
 scale a range about its center point. More...
 
bool IsNull () const
 Check if the range is exactly the same as the null ranges of a just-initialized range. More...
 
double ExtentSquared () const
 returns 0 if the range is null (Range3dIsNull), otherwise sum of squared axis extents. More...
 
bool IsEmpty () const
 Test if low component is (strictly) less than high in any direction. More...
 
bool IsPoint () const
 
double Volume () const
 returns product of axis extents. No test for zero or negative axes. More...
 
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...
 
double ZLength () const
 Returns difference of high and low in z direction – 0 if high < low. More...
 
double DiagonalDistance () const
 Returns the length of the xyz diagonal – 0 if null range. More...
 
double DiagonalDistanceXY () const
 Returns the length of the xy diagonal – 0 if null range. More...
 
DVec3d DiagonalVector () const
 Returns the diagonal vector – 000 if null range. More...
 
DVec3d DiagonalVectorXY () const
 Returns the XY part of the diagonal vector – 000 if null range. More...
 
bool IsAlmostZeroZ () const
 Test if z size is small compared to x and y. More...
 
bool IsAlmostZeroY () const
 Test if y size is small compared to x and z. More...
 
bool IsAlmostZeroX () const
 Test if x size is small compared to y and z. More...
 
double LargestCoordinate () const
 
double MaxAbs () const
 
double LargestCoordinateXY () const
 
void Get8Corners (DPoint3dP box) const
 Generates an 8point box around around a range cube. More...
 
void Get6Planes (DPoint3dP originArray, DPoint3dP normalArray) const
 Extract the 6 bounding planes for a range cube. More...
 
DRange1d GetComponentDRange1d (int index) const
 Extract a single component (x,y,z) as a DRange1d. More...
 
DRange1d GetCornerRange (DRay3dCR ray) const
 Compute range of dot products of ray.direction with vectors from ray.origin to corners of the range. More...
 
DRange1d GetCornerRange (DPlane3dCR plane) const
 Compute range of dot products of plane.normal with vectors from plane.origin to corners of the range. More...
 
int IndexOfMaximalAxis () const
 Return the index of the axis with largest absolute range. More...
 
DPoint3d LocalToGlobal (double xFraction, double yFraction, double zFraction) const
 Convert fractional coordinates in x,y,z directions to global coordinates. More...
 
bool IsContained (DRange3dCR outerRange) const
 Test if the first range is contained in the second range. More...
 
double DistanceOutside (DPoint3dCR xyz) const
 Compute the smallest distance from xyz to the range. More...
 
double DistanceSquaredOutside (DPoint3dCR xyz) const
 Compute the smallest distance squared from xyz to the range. More...
 
double DistanceSquaredTo (DRange3dCR other) const
 Compute the smallest distance to the other range. More...
 
bool IsContained (DPoint3dCR point) const
 Test if a point is contained in a range. More...
 
bool IsContainedXY (DPoint3dCR point) const
 Test if a point is contained in a range, using only xy parts. More...
 
bool IsContained (DPoint3dCR point, int numDimensions) const
 Test if a point is contained in a range, using 1,2,or 3 dimensions. More...
 
bool IsContained (double x, double y, double z) const
 Test if a point given as x,y,z is contained in a range. More...
 
bool IntersectsWith (DRange3dCR range2) const
 Test if two ranges have strictly non-null overlap (intersection) More...
 
bool IntersectsWith (DRange3dCR range2, int numDimensions) const
 Test if two ranges have strictly non-null overlap (intersection) in 1,2, or 3 dimensions. More...
 
bool IntersectsWith (DRange3dCR range2, double gapSize, int numDimensions) const
 Test if two ranges have strictly non-null overlap (intersection) in 1,2, or 3 dimensions, with a scalar gap added in all dimensions. More...
 
bool IsEqual (DRange3dCR range1) const
 Test if two ranges are exactly equal. More...
 
bool IsEqual (DRange3dCR range1, double tolerance) const
 Test if two ranges are equal within a tolerance applied componentwise. More...
 
bool IsStrictlyContainedXY (DRange3dCR outerRange) const
 Test if the given range is a proper subset of outerRange, using only xy parts. More...
 
void RestrictToMinMax (DRange3dCR range0, DRange3dCR minMax)
 Returns a range which is the intersection of two ranges. More...
 
bool IntersectRay (double &param0, double &param1, DPoint3dR point0, DPoint3dR point1, DPoint3dCR start, DPoint3dCR direction) const
 Compute the intersection of a range cube and a ray. More...
 
bool IntersectBounded (double &param0, double &param1, DSegment3dR clipped, DSegment3dCR segment) const
 Compute the intersection of a range cube and a ray. More...
 
double IntersectionExtentSquared (DRange3dCR range2) const
 Compute the intersection of given range with another range and return the extentSquared of the intersection range. More...
 
bool MoveChangesIntersection (DRange3dCR newRange, DRange3dCR 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 DRange3d NullRange ()
 Initializes a range cube with (inverted) large positive and negative values. More...
 
static DRange3d From (DPoint3dCR point)
 Initializes the range to contain the single given point. More...
 
static DRange3d From (DPoint3dCR point0, DPoint3dCR point1)
 Initializes the range to contain the two given points. More...
 
static DRange3d From (double x, double y, double z)
 Initialize the range.InitFrom a single point given by components. More...
 
static DRange3d From (double x0, double y0, double z0, double x1, double y1, double z1)
 Initializes the range to contain two points given as components. More...
 
static DRange3d FromMinMax (double v0, double v1)
 Initialize the range.InitFrom given min and max in all directions. More...
 
static DRange3d From (DPoint3dCR point0, DPoint3dCR point1, DPoint3dCR point2)
 Initializes a range to contain three given points. More...
 
static DRange3d From (DPoint3dCP point, int n)
 Initizlizes the range to contain the range of the given array of points. More...
 
static DRange3d From (DPoint3dCP point, const double *pWeight, int n)
 Initizlizes the range to contain the range of the given array of points. More...
 
static DRange3d From (TransformCR transform, DPoint3dCP point, const double *pWeight, int n)
 Initizlizes the range to contain the range of the given array of points. More...
 
static DRange3d From (bvector< DPoint3d > const &points)
 Return a range of points. More...
 
static DRange3d From (bvector< bvector< DPoint3d >> const &points)
 Return a range of points. More...
 
static DRange3d From (bvector< bvector< bvector< DPoint3d >>> const &points)
 Return a range of points. More...
 
static DRange3d From (TransformCR transform, bvector< DPoint3d > const &points)
 Return a range of transformed points. More...
 
static DRange3d From (TransformCR transform, bvector< DPoint4d > const &points)
 Return a range of transformed points. More...
 
static DRange3d From (bvector< DPoint3d > const &points, bvector< double > const *weights)
 Return a range of points with optional weights. More...
 
static DRange3d From (bvector< DPoint4d > const &points)
 Return a range of points. More...
 
static DRange3d From (DPoint2dCP point, int n, double zVal)
 Initializes the range to contain the range of the given array of 2D points, with a single given z value for both the min and max points. More...
 
static DRange3d From (bvector< DPoint2d > const &points, double zValue)
 Return a range of points with fixed z. More...
 
static DRange3d From (bvector< bvector< DPoint2d > > const &points, double zValue)
 Return a range of points with fixed z. More...
 

Public Attributes

DPoint3d low
 low point of box More...
 
DPoint3d high
 high point of box More...
 

Detailed Description

A 3d low and high corner pair for range boxes.

The low and high members (points) are public, but should only be accessed for reading.

Member Function Documentation

double DiagonalDistance ( ) const

Returns the length of the xyz diagonal – 0 if null range.

double DiagonalDistanceXY ( ) const

Returns the length of the xy diagonal – 0 if null range.

DVec3d DiagonalVector ( ) const

Returns the diagonal vector – 000 if null range.

DVec3d DiagonalVectorXY ( ) const

Returns the XY part of the diagonal vector – 000 if null range.

double DistanceOutside ( DPoint3dCR  xyz) const

Compute the smallest distance from xyz to the range.

This is 0 for any point inside the range.

Parameters
[in]xyzspace point.
Returns
distance from xyz to closest point of the range.
double DistanceSquaredOutside ( DPoint3dCR  xyz) const

Compute the smallest distance squared from xyz to the range.

This is 0 for any point inside the range.

Parameters
[in]xyzspace point.
Returns
distance squared from xyz to closest point of the range.
double DistanceSquaredTo ( DRange3dCR  other) const

Compute the smallest distance to the other range.

This is 0 if the ranges overlap.

Parameters
[in]othersecond range
Returns
distance between range cubes (i.e. edge to edge or vertex to edge)
void Extend ( DPoint3dCR  point)

Extends the coordinates of the range cube points in pRange so as to include the single additional point point.

Parameters
[in]pointnew point to be included in the range.
void Extend ( DPoint3dCR  point,
double  weight 
)

Extends the coordinates of the range cube points in pRange so as to include the single additional weighted point.

Parameters
[in]pointnew point to be included in the range.
[in]weightweight. Point coordinates are divided by the weight.
void Extend ( double  x,
double  y,
double  z 
)

Extends the coordinates of the range cube points in pRange so as to include the single additional point at x,y,z.

Parameters
[in]xextended range coordinate
[in]yextended range coordinate
[in]zextended range coordinate
void Extend ( DPoint3dCP  array,
int  n 
)

extends the coordinates of the range cube points in pRange so as to include range of an array of points.

Parameters
[in]arraynew points to be included in minmax ranges
[in]nnumber of points
void Extend ( bvector< DPoint3d > const &  points)

Expand a range to include points.

Parameters
[in]pointsnew points to be included in minmax ranges
void Extend ( TransformCR  transform,
DPoint3dCP  points,
int  n 
)

extends the coordinates of the range cube by transformed points

Parameters
[in]transformtransform to apply to points.
[in]pointsnew points to be included in minmax ranges
[in]nnumber of points
void Extend ( TransformCR  transform,
DPoint3dCP  points,
double const *  weights,
int  n 
)

extends the coordinates of the range cube by transformed points

Parameters
[in]transformtransform to apply to points.
[in]pointsnew points to be included in minmax ranges
[in]weightsweights
[in]nnumber of points
void Extend ( TransformCR  transform,
bvector< DPoint3d > const &  points 
)

Expand a range to include transformed points.

Parameters
[in]transformtransform to apply
[in]pointsnew points to be included in minmax ranges
void Extend ( TransformCR  transform,
bvector< DPoint4d > const &  points 
)

Expand a range to include transformed points.

Parameters
[in]transformtransform to apply
[in]pointsnew points to be included in minmax ranges
void Extend ( bvector< DPoint3d > const &  points,
bvector< double > const *  weights 
)

Expand a range to include points with optional weights.

Parameters
[in]pointsnew points to be included in minmax ranges
[in]weightscorrespnding weights.
void Extend ( DPoint4dCR  point4d)

extends the coordinates of the range cube points in pRange so as to include the (normalized image of) the given 4D point.

Parameters
[in]point4dnew point to be included in minmax ranges
void Extend ( DPoint4dCP  point4d,
int  numPoint 
)

extends the coordinates of the range cube points in pRange so as to include the (normalized image of the) array of DPoint4d

Parameters
[in]point4darray of to be included in minmax ranges
[in]numPointnumber of points in the array.
void Extend ( bvector< DPoint4d > const &  points)

Expand a range to include points.

Parameters
[in]pointsarray of to be included in minmax ranges
void Extend ( bvector< DPoint2d > const &  points,
double  zValue 
)

Expand a range to include points with fixed z.

Parameters
[in]pointsnew points to be included in minmax ranges
[in]zValuez coordinate for all points.
void Extend ( double  extend)

Extend each axis by the given distance on both ends of the range.

Parameters
[in]extenddistance to extend
void Extend ( DRange3dCR  range1)

extends the coordinates of the range cube points to include the range cube range1P.

Parameters
[in]range1second range
void Extend ( DEllipse3dCR  ellipse)

extends the coordinates of the range cube points to include an ellipse

Parameters
[in]ellipse
void ExtendBySweep ( DVec3dCR  vector)

Extend either low or high of each axis by corresponding vector entry for sweep of the range cube.

Any axis with low > high is left unchanged.

Parameters
[in]vectorsweep drection
double ExtentSquared ( ) const

returns 0 if the range is null (Range3dIsNull), otherwise sum of squared axis extents.

Returns
squared magnitude of the diagonal vector.
static DRange3d From ( DPoint3dCR  point)
static

Initializes the range to contain the single given point.

Parameters
[in]pointthe point
static DRange3d From ( DPoint3dCR  point0,
DPoint3dCR  point1 
)
static

Initializes the range to contain the two given points.

Parameters
[in]point0first point
[in]point1second point
static DRange3d From ( double  x,
double  y,
double  z 
)
static

Initialize the range.InitFrom a single point given by components.

Parameters
[in]xx coordinate
[in]yy coordinate
[in]zz coordinate
static DRange3d From ( double  x0,
double  y0,
double  z0,
double  x1,
double  y1,
double  z1 
)
static

Initializes the range to contain two points given as components.

Minmax logic is applied to the given points.

Parameters
[in]x0first x
[in]y0first y
[in]z0first z
[in]x1second x
[in]y1second y
[in]z1second z
static DRange3d From ( DPoint3dCR  point0,
DPoint3dCR  point1,
DPoint3dCR  point2 
)
static

Initializes a range to contain three given points.

Parameters
[in]point0first point
[in]point1second point
[in]point2third point
static DRange3d From ( DPoint3dCP  point,
int  n 
)
static

Initizlizes 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 DRange3d::init()

Parameters
[in]pointarray of points to search
[in]nnumber of points in array
static DRange3d From ( DPoint3dCP  point,
const double *  pWeight,
int  n 
)
static

Initizlizes 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 DRange3d::init()

Parameters
[in]pointarray of points to search
[in]pWeightarray of corresponding weights
[in]nnumber of points in array
static DRange3d From ( TransformCR  transform,
DPoint3dCP  point,
const double *  pWeight,
int  n 
)
static

Initizlizes 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 DRange3d::init()

Parameters
[in]transformtransform to apply
[in]pointarray of points to search
[in]pWeightarray of corresponding weights
[in]nnumber of points in array
static DRange3d From ( bvector< DPoint3d > const &  points)
static

Return a range of points.

Parameters
[in]pointsnew points to be included in minmax ranges
static DRange3d From ( bvector< bvector< DPoint3d >> const &  points)
static

Return a range of points.

Parameters
[in]pointsnew points to be included in minmax ranges
static DRange3d From ( bvector< bvector< bvector< DPoint3d >>> const &  points)
static

Return a range of points.

Parameters
[in]pointsnew points to be included in minmax ranges
static DRange3d From ( TransformCR  transform,
bvector< DPoint3d > const &  points 
)
static

Return a range of transformed points.

Parameters
[in]transformtransform to apply
[in]pointsnew points to be included in minmax ranges
static DRange3d From ( TransformCR  transform,
bvector< DPoint4d > const &  points 
)
static

Return a range of transformed points.

Parameters
[in]transformtransform to apply
[in]pointsnew points to be included in minmax ranges
static DRange3d From ( bvector< DPoint3d > const &  points,
bvector< double > const *  weights 
)
static

Return a range of points with optional weights.

Parameters
[in]pointsnew points to be included in minmax ranges
[in]weightscorrespnding weights.
static DRange3d From ( bvector< DPoint4d > const &  points)
static

Return a range of points.

Parameters
[in]pointsarray of to be included in minmax ranges
static DRange3d From ( DPoint2dCP  point,
int  n,
double  zVal 
)
static

Initializes the range to contain the range of the given array of 2D points, with a single given z value for both the min and max points.

If there are no points in the array, the range is initialized by DRange3d::init()

Parameters
[in]pointarray of points to search
[in]nnumber of points in array
[in]zValdefault z value
static DRange3d From ( bvector< DPoint2d > const &  points,
double  zValue 
)
static

Return a range of points with fixed z.

Parameters
[in]pointsnew points to be included in minmax ranges
[in]zValuez coordinate for all points.
static DRange3d From ( bvector< bvector< DPoint2d > > const &  points,
double  zValue 
)
static

Return a range of points with fixed z.

Parameters
[in]pointsnew points to be included in minmax ranges
[in]zValuez coordinate for all points.
static DRange3d FromMinMax ( double  v0,
double  v1 
)
static

Initialize the range.InitFrom given min and max in all directions.

Given values will be swapped if needed.

Parameters
[in]v0min (or max)
[in]v1max (or min)
void Get6Planes ( DPoint3dP  originArray,
DPoint3dP  normalArray 
) const

Extract the 6 bounding planes for a range cube.

Parameters
[out]originArrayarray of plane origins
[out]normalArrayarray of plane normals
void Get8Corners ( DPoint3dP  box) const

Generates an 8point box around around a range cube.

Point ordering is maintained from the cube.

Parameters
[out]boxarray of 8 points of the box
DRange1d GetComponentDRange1d ( int  index) const

Extract a single component (x,y,z) as a DRange1d.

Parameters
[in]indexcomponent index interpretted cyclically.
Returns
single component range. Ranges may be null independently.
DRange1d GetCornerRange ( DRay3dCR  ray) const

Compute range of dot products of ray.direction with vectors from ray.origin to corners of the range.

(The ray direction is NOT renormalized on each call)

Parameters
[in]rayorigin and vector for dot products.
DRange1d GetCornerRange ( DPlane3dCR  plane) const

Compute range of dot products of plane.normal with vectors from plane.origin to corners of the range.

(The plane normal is NOT renormalized on each call)

Parameters
[in]planeorigin and vector for dot products.
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 ( DPoint3dCR  point)

Initializes the range to contain the single given point.

Parameters
[in]pointthe point
void InitFrom ( DPoint3dCR  point0,
DPoint3dCR  point1 
)

Initializes the range to contain the two given points.

Parameters
[in]point0first point
[in]point1second point
void InitFrom ( double  x,
double  y,
double  z 
)

Initialize the range from a single point given by components.

Parameters
[in]xx coordinate
[in]yy coordinate
[in]zz coordinate
void InitFrom ( double  x0,
double  y0,
double  z0,
double  x1,
double  y1,
double  z1 
)

Initializes the range to contain two points given as components.

Minmax logic is applied to the given points.

Parameters
[in]x0first x
[in]y0first y
[in]z0first z
[in]x1second x
[in]y1second y
[in]z1second z
void InitFrom ( DPoint3dCR  point0,
DPoint3dCR  point1,
DPoint3dCR  point2 
)

Initializes a range to contain three given points.

Parameters
[in]point0first point
[in]point1second point
[in]point2third point
void InitFrom ( DPoint3dCP  point,
int  n 
)

Initizlizes 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 DRange3d::init()

Parameters
[in]pointarray of points to search
[in]nnumber of points in array
void InitFrom ( bvector< DPoint3d > const &  points)

Initialize a range to include points.

Parameters
[in]pointsnew points to be included in minmax ranges
void InitFrom ( TransformCR  transform,
bvector< DPoint3d > const &  points 
)

Initialize a range to include transformed points.

Parameters
[in]transformtransform to apply
[in]pointsnew points to be included in minmax ranges
void InitFrom ( DPoint3dCP  point,
const double *  pWeight,
int  n 
)

Initizlizes 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 DRange3d::init()

Parameters
[in]pointarray of points to search
[in]pWeightarray of corresponding weights
[in]nnumber of points in array
void InitFrom ( bvector< DPoint3d > const &  points,
bvector< double > const *  weights 
)

Initialize a range to include points with optional weights.

Parameters
[in]pointsnew points to be included in minmax ranges
[in]weightscorrespnding weights.
void InitFrom ( bvector< DPoint4d > const &  points)

Initialize a range to include points.

Parameters
[in]pointsarray of to be included in minmax ranges
void InitFrom ( DPoint2dCP  point,
int  n,
double  zVal 
)

Initializes the range to contain the range of the given array of 2D points, with a single given z value for both the min and max points.

If there are no points in the array, the range is initialized by DRange3d::init()

Parameters
[in]pointarray of points to search
[in]nnumber of points in array
[in]zValdefault z value
void InitFrom ( bvector< DPoint2d > const &  points,
double  zValue 
)

Initialize a range to include points with fixed z.

Parameters
[in]pointsnew points to be included in minmax ranges
[in]zValuez coordinate for all points.
void InitFromMinMax ( double  v0,
double  v1 
)

Initialize the range from given min and max in all directions.

Given values will be swapped if needed.

Parameters
[in]v0min (or max)
[in]v1max (or min)
bool IntersectBounded ( double &  param0,
double &  param1,
DSegment3dR  clipped,
DSegment3dCR  segment 
) 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 the output segment consists of only the start point.

Parameters
[out]param0ray parameter where cube is entered
[out]param1ray parameter where cube is left
[out]clippedclipped segment
[out]segmentline segment to intersect with range cube.
Returns
true if non-empty intersection.
void IntersectIndependentComponentsOf ( DRange3dCR  range1,
DRange3dCR  range2 
)

Compute intersection of x,y,z components independently.

Parameters
[in]range1first range
[in]range2second range
double IntersectionExtentSquared ( DRange3dCR  range2) const

Compute the intersection of given range with another range and return the extentSquared of the intersection range.

Parameters
[in]range2second range
Returns
extentSquared() for the intersection range.
void IntersectionOf ( DRange3dCR  range1,
DRange3dCR  range2 
)

Compute the intersection of two ranges.

If any direction has no intersection the result range is initialized to a null range. (Zero thickness intersection is null.)

Parameters
[in]range1first range
[in]range2second range
bool IntersectRay ( double &  param0,
double &  param1,
DPoint3dR  point0,
DPoint3dR  point1,
DPoint3dCR  start,
DPoint3dCR  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.

Parameters
[out]param0ray parameter where cube is entered
[out]param1ray parameter where cube is left
[out]point0entry point
[out]point1exit point
[in]startstart point of ray
[in]directiondirection of ray
Returns
true if non-empty intersection.
bool IntersectsWith ( DRange3dCR  range2) const

Test if two ranges have strictly non-null overlap (intersection)

Parameters
[in]range2second range
Returns
true if ranges overlap, false if not.
bool IntersectsWith ( DRange3dCR  range2,
int  numDimensions 
) const

Test if two ranges have strictly non-null overlap (intersection) in 1,2, or 3 dimensions.

Parameters
[in]range2second range
[in]numDimensions1,2, or 3
Returns
true if ranges overlap, false if not.
bool IntersectsWith ( DRange3dCR  range2,
double  gapSize,
int  numDimensions 
) const

Test if two ranges have strictly non-null overlap (intersection) in 1,2, or 3 dimensions, with a scalar gap added in all dimensions.

Parameters
[in]range2second range
[in]gapSizeapproach within this distance in any direction is considered an intersection.
[in]numDimensions1,2, or 3
Returns
true if ranges overlap, false if not.
bool IsAlmostZeroX ( ) const

Test if x size is small compared to y and z.

bool IsAlmostZeroY ( ) const

Test if y size is small compared to x and z.

bool IsAlmostZeroZ ( ) const

Test if z size is small compared to x and y.

bool IsContained ( DRange3dCR  outerRange) const

Test if the first range is contained in the second range.

Parameters
[in]outerRangecandidate outer range.
Returns
true if the inner range is a (possibly improper) subset of the outer range.
bool IsContained ( DPoint3dCR  point) const

Test if a point is contained in a range.

Parameters
[in]pointpoint to test.
Returns
true if the point is in (or on boundary of)
bool IsContained ( DPoint3dCR  point,
int  numDimensions 
) const

Test if a point is contained in a range, using 1,2,or 3 dimensions.

Parameters
[in]pointpoint to test.
[in]numDimensions(1,2, or 3) number of dimensions to include in test.
Returns
true if the point is in (or on boundary of)
bool IsContained ( double  x,
double  y,
double  z 
) const

Test if a point given as x,y,z is contained in a range.

Parameters
[in]xx coordinate
[in]yy coordinate
[in]zz coordinate
Returns
true if the point is in (or on boundary of)
bool IsContainedXY ( DPoint3dCR  point) const

Test if a point is contained in a range, using only xy parts.

Parameters
[in]pointpoint to test.
Returns
true if the point is in (or on boundary of)
bool IsEmpty ( ) const

Test if low component is (strictly) less than high 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 ( DRange3dCR  range1) const

Test if two ranges are exactly equal.

Parameters
[in]range1second range
Returns
true if ranges are identical in all components.
bool IsEqual ( DRange3dCR  range1,
double  tolerance 
) const

Test if two ranges are equal within a tolerance applied componentwise.

Parameters
[in]range1second range
[in]tolerancetoleranc to be applied to each component
Returns
true if ranges are within tolerance in all components.
bool IsNull ( ) const

Check if the range is exactly the same as the null ranges of a just-initialized range.

Returns
true if the range is null.
bool IsPoint ( ) const
Returns
true if high is exactly equal to low in every direction.
bool IsStrictlyContainedXY ( DRange3dCR  outerRange) const

Test if the given range is a proper subset of outerRange, using only xy parts.

Parameters
[in]outerRangeouter range
Returns
true if the given range is a proper subset of outerRange.
double LargestCoordinate ( ) const
Returns
the largest individual coordinate value among (a) range min point, (b) range max point, and (c) range diagonal vector.
double LargestCoordinateXY ( ) const
Returns
the largest individual XY coordinate value among (a) range min point, (b) range max point, and (c) range diagonal vector.
DPoint3d LocalToGlobal ( double  xFraction,
double  yFraction,
double  zFraction 
) const

Convert fractional coordinates in x,y,z directions to global coordinates.

Parameters
[in]xFraction
[in]yFraction
[in]zFraction
Returns
interpolated point.
double MaxAbs ( ) const
Returns
the largest individual coordinate value among range low and high, zero if empty range.
bool MoveChangesIntersection ( DRange3dCR  newRange,
DRange3dCR  outerRange 
) const

Test if a modification of the given (instance) range would have a different touching relationship with outerRange.

Remarks
This may only be meaningful in context of range tree tests where some prior relationship among ranges is known to apply.
Parameters
[in]newRangecandidate for modified range relationship.
[in]outerRangecontaining range
Returns
true if touching condition occurs.
static DRange3d NullRange ( )
static

Initializes a range cube with (inverted) large positive and negative values.

void RestrictToMinMax ( DRange3dCR  range0,
DRange3dCR  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, instance high and low values are identical and are at the limit of minMax that is nearer to the values in range0. (Intended use: range0 is the 'actual' stroking range of a surface i.e. may go 'backwards'. minMax 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 instance may be the same address. minMax must be different.

Parameters
[in]range0range to be restricted
[in]minMaxallowable minmax range. Assumed to have low < high
void ScaleAboutCenter ( DRange3dCR  rangeIn,
double  scale 
)

scale a range about its center point.

Parameters
[in]rangeInoriginal range
[in]scalescale factor
void UnionOf ( DRange3dCR  range0,
DRange3dCR  range1 
)

returns the union of two ranges.

Parameters
[in]range0first range
[in]range1second range
double Volume ( ) const

returns product of axis extents. No test for zero or negative axes.

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.

double ZLength ( ) const

Returns difference of high and low in z direction – 0 if high < low.

Member Data Documentation

DPoint3d high

high point of box

Referenced by RTree2dVal::ToRange(), and RTree3dVal::ToRangeR().

DPoint3d low

low point of box

Referenced by RTree2dVal::ToRange(), and RTree3dVal::ToRangeR().


The documentation for this struct was generated from the following file:

Copyright © 2017 Bentley Systems, Incorporated. All rights reserved.