DG Kernel Documentation


Skip Navigation Links.
Skip Navigation LinksHome Page > API Reference > General Geometry > Oriented Objects > IBox_DG Search Documentation


IBox_DG Interface

Init
GetRange
GetRange1
SetRange
SetRange1
SetAll
GetLocation
SetLocation
GetLimit
IsEmpty
SetEmpty
IsIn
IsIn1
GetPointLocation
Include
Include1
Expand
Translate
GetCentre
GetCorner
GetPoint
GetRatios
GetSize
GetMaxSize
GetDiagonalLength
GetVolume
GetPlane
GetDist
GetDistBox
GetLineIntersection
Copy

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


void Init(double minx, double maxx, double miny, double maxy, double minz, double maxz)


void GetRange(int axis, double *min, double *max)


Range_DG GetRange1(int axis)


void SetRange(int axis, double min, double max)


void SetRange1(int axis, Range_DG range)


void SetAll(double min, double max)


IFrame_DG GetLocation()

Accesses location (and orientation) of the box. For a standalone box and some other implementations, the returned interface acts as a reference to the frame, so that its modifications are reflected immediately and there is no need to call SetLocation(). This is not always true for some complex underlying objects. It is recommended to test this behaviour in each case.


void SetLocation(IFrame_DG frame)

Copies location of frame

For a standalone box and some other implementations, the interface returned by the GetLocation() above acts as a reference to the frame, so that its modifications are reflected immediately and there is no need to call SetLocation(). This is not always true for some complex underlying objects. It is recommended to test this behaviour in each case.


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(Point_DG point, double tolerance)

point must have global coordinates


bool IsIn1(double x, double y, double z, double tolerance)

x,y,z are assumed to be global coordinates


int GetPointLocation(Point_DG 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(Point_DG point)

point must have global coordinates. Expands this by the minimal value to include the point.


void Include1(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


Point_DG GetCentre()


Point_DG 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).


Point_DG GetPoint(Point_DG ratiosAt)

coordinates of ratiosAt are assumed to be in [0, 1] range. 0.0 is mapped to min, 1.0 is mapped to max


Point_DG GetRatios(Point_DG 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(Point_DG point)

point must have global coordinates


double GetDistBox(IBox_DG box)

Returns distance this to box


int GetLineIntersection(ILine_DG line, out Range_DG 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)