IBox_DG Interface
IBox_DG represents a box arbitrary located and oriented in 3D. By default its location is the global frame (identity), in which case
global and local coordinates are the same and the object can be used as an axis-aligned box. Use Get/SetLocation() to modify
orientation or location of the box.
A standalone box for calculations can be created using IObjectGenerator_DG:
IModel_DG > IObjectGenerator_DG > Create<Box_DG>() > IUnknown > IBox_DG
Properties
- IFrame_DG Location
Methods
- Init
- GetRange
- GetRange
- SetRange
- SetRange
- SetAll
- GetLimit
- IsEmpty
- SetEmpty
- IsIn
- IsIn
- GetPointLocation
- Include
- Include
- Expand
- Translate
- GetCentre
- GetCorner
- GetPoint
- GetRatios
- GetSize
- GetMaxSize
- GetDiagonalLength
- GetVolume
- GetPlane
- GetDist
- GetDist
- GetDistBox
- GetLineIntersection
- Copy
- Clone
void Init(double minx, double maxx, double miny, double maxy, double minz, double maxz)
void GetRange(int axis, double *min, double *max)
RangeDg GetRange(int axis)
void SetRange(int axis, double min, double max)
void SetRange(int axis, RangeDg range)
void SetAll(double min, double max)
double GetLimit(int axis, bool min)
bool IsEmpty()
Returns true if min > max + gTol(1e-10) for either axis
void SetEmpty()
Makes the box empty by calling SetAll(inf, -inf), where inf=10e+306
bool IsIn(PointDg point, double tolerance)
point must have global coordinates
bool IsIn(double x, double y, double z, double tolerance)
x,y,z are assumed to be global coordinates
int GetPointLocation(PointDg point, double tolerance)
Returns one of:
0 - An error
1 - Inside the open 3D area of the box
2 - At a corner
3 - On an edge
4 - Inside an open 2D area of a face
5 - Anywhere on the external surface. Never returned in this version.
6 - Anywhere on the external surface or inside. Never returned in this version.
7 - Strictly outside (In the open 3D external space).
void Include(PointDg point)
point must have global coordinates. Expands this by the minimal value to include the point.
void Include(double x, double y, double z)
x,y,z are assumed to be global coordinates. Expands this by the minimal value to include the point.
void Expand(double by)
Executes min -= by; max += by;
void Translate(double vx, double vy, double vz)
vx,vy,vz are assumed to be global coordinates. Modifies the ranges by the specified values. Location remains unchanged. Use Get/SetLocation() to set location of the whole box instead
PointDg GetCentre()
PointDg GetCorner(int index)
Corners are enumerated as:
Back (z = min): 0-left bottom(x=min,y=min), 1-right bottom(x=max,y=min), 2-right top(x=max,y=max), 3-left top(x=min,y=max).
Front (z = max): 4-left bottom(x=min,y=min), 5-right bottom(x=max,y=min), 6-right top(x=max,y=max), 7-left top(x=min,y=max).
PointDg GetPoint(PointDg ratiosAt)
coordinates of ratiosAt are assumed to be in [0, 1] range. 0.0 is mapped to min, 1.0 is mapped to max
PointDg GetRatios(PointDg point)
Converts global coordinates to ratios in [0, 1] range. 0.0 is mapped to min, 1.0 is mapped to max
double GetSize(int axis)
Returns length of the axis-th range
double GetMaxSize(bool maxNotMin)
Returns maximal or minimal length of the three ranges
double GetDiagonalLength()
Returns the distance (min,min,min) to (max,max,max)
double GetVolume()
IPlane_DG GetPlane(int axis, bool min)
double GetDist(PointDg point)
point must have global coordinates
double GetDist(PointDg point, out PointDg pointNearest)
point must have global coordinates. pointNearest - is the nearest point inside this box
double GetDistBox(IBox_DG box)
Returns distance this to box
int GetLineIntersection(ILine_DG line, out RangeDg uInside)
Intersection of this and the infinite 3D line
Returns 0, 1, 2 or 3 - number of different intersection points with the surface. 3 - means that the line lies on a face of this box or coinsides with an edge
The uInside will be set to the range of line parameters lying inside this box
void Copy(IBox_DG box)
IBox_DG Clone()
Returns a new copy of this.
|