#include <Cubic_Bounding_Box.h>
Inherits Bounding_Box< Cubic_Bounding_Box >.
Inherited by Cubic_Bounding_Box_Container.
Inheritance diagram for Cubic_Bounding_Box:
Public Member Functions | |
Cubic_Bounding_Box () | |
virtual void | writeToFile (ofstream &ofs) const |
virtual bool | lineIntersect (const vector< double > &start, const vector< double > &end) const |
Cubic_Bounding_Box (vector< double > &mins, vector< double > &maxs) | |
Cubic_Bounding_Box (const vector< double > &mins, const vector< double > &maxs) | |
~Cubic_Bounding_Box () | |
Cubic_Bounding_Box (const Cubic_Bounding_Box *toCopy) | |
virtual void | clear () |
virtual void | become (const Cubic_Bounding_Box *toCopy) |
double | getMinCoordinateOnDimension (unsigned int i) const |
double | getMaxCoordinateOnDimension (unsigned int i) const |
virtual bool | isEmpty () const |
virtual void | getCenterCoordinate (vector< double > *into) const |
virtual bool | intersects (const Cubic_Bounding_Box &other) const |
virtual bool | contains (const Point &x) const |
virtual bool | contains (const Cubic_Bounding_Box &other) const |
virtual void | unite (const Cubic_Bounding_Box *other) |
virtual Cubic_Bounding_Box | unionWith (const Cubic_Bounding_Box &other) const |
virtual Cubic_Bounding_Box | intersect (const Cubic_Bounding_Box &other) const |
virtual string | toString () const |
virtual unsigned int | getDimension () const |
virtual bool | isDefining (Cubic_Bounding_Box *other) const |
Static Public Member Functions | |
static Ordering< Cubic_Bounding_Box > * | getDefaultOrdering () |
static vector< Ordering< Cubic_Bounding_Box > * > | getOrderings () |
Static Public Attributes | |
static CubicLowCoorOrdering< 0, Cubic_Bounding_Box > | LCX_ORDERING = CubicLowCoorOrdering< 0, Cubic_Bounding_Box >() |
static CubicLowCoorOrdering< 1, Cubic_Bounding_Box > | LCY_ORDERING = CubicLowCoorOrdering< 1, Cubic_Bounding_Box >() |
static CubicLowCoorOrdering< 2, Cubic_Bounding_Box > | LCZ_ORDERING = CubicLowCoorOrdering< 2, Cubic_Bounding_Box >() |
static DistOrdering< Cubic_Bounding_Box > | DIST_ORDERING = DistOrdering< Cubic_Bounding_Box >() |
Static Protected Member Functions | |
static double | UtilDivideSafe (const double num, const double denom, const double defaultRes) |
static bool | BBOverlap (const double *bb1Min, const double *bb1Max, const double *bb2Min, const double *bb2Max, const int dim) |
static bool | BBEdgeIntersect (const int dim, const double *point1, const double *point2, const double *minBB, const double *maxBB, const int dir, const double fixed_val) |
Protected Attributes | |
vector< double > | _mins |
vector< double > | _maxs |
Static Protected Attributes | |
static vector< double > | temp1 = vector< double >( 3 ) |
static vector< double > | temp2 = vector< double >( 3 ) |
Private Member Functions | |
bool | contains (const vector< double > *x) const |
vector< double > | axpy (const double a, const vector< double > *x, const vector< double > *y) const |
Friends | |
class | CubicLowCoorOrdering< 0, Cubic_Bounding_Box > |
class | CubicLowCoorOrdering< 1, Cubic_Bounding_Box > |
class | CubicLowCoorOrdering< 2, Cubic_Bounding_Box > |
class | DistOrdering< Cubic_Bounding_Box > |
class | Bisection_Tree |
class | Cart |
class | Basic_R_tree |
Definition at line 43 of file Cubic_Bounding_Box.h.
Cubic_Bounding_Box::Cubic_Bounding_Box | ( | ) | [inline] |
Base constructor
Definition at line 374 of file Cubic_Bounding_Box.h.
References clear().
Referenced by intersect(), and unionWith().
Cubic_Bounding_Box::Cubic_Bounding_Box | ( | vector< double > & | mins, | |
vector< double > & | maxs | |||
) | [inline] |
Base constructor of a hybercubic bounding box.
mins | Contains the minimum coordinates on each dimension. | |
maxs | Contains the maximum coordinates on each dimension. |
Definition at line 474 of file Cubic_Bounding_Box.h.
Cubic_Bounding_Box::Cubic_Bounding_Box | ( | const vector< double > & | mins, | |
const vector< double > & | maxs | |||
) | [inline] |
Base constructor of a hybercubic bounding box. Const variant.
mins | Contains the minimum coordinates on each dimension. | |
maxs | Contains the maximum coordinates on each dimension. |
Definition at line 495 of file Cubic_Bounding_Box.h.
Cubic_Bounding_Box::~Cubic_Bounding_Box | ( | ) | [inline] |
Base deconstructor. Does not do anything.
Definition at line 512 of file Cubic_Bounding_Box.h.
Cubic_Bounding_Box::Cubic_Bounding_Box | ( | const Cubic_Bounding_Box * | toCopy | ) | [inline] |
Copy constructor.
toCopy | Cubic bounding box to copy |
Definition at line 521 of file Cubic_Bounding_Box.h.
References become().
bool Cubic_Bounding_Box::contains | ( | const vector< double > * | x | ) | const [inline, private] |
Convenience method -- instead for point-containment with the point-class, we use here a simple vector.
x | Pointer to a coordinate vector. |
Definition at line 79 of file Cubic_Bounding_Box.h.
References _maxs, _mins, and isEmpty().
Referenced by contains(), lineIntersect(), and R_tree< r_tree_variation >::updateMBRLocal().
vector< double > Cubic_Bounding_Box::axpy | ( | const double | a, | |
const vector< double > * | x, | |||
const vector< double > * | y | |||
) | const [inline, private] |
Standard axpy operation. Convenience method. Assumes equality in dimensions.
a | A scalar. | |
x | A vector. | |
y | A vector of the same size as x. |
Definition at line 113 of file Cubic_Bounding_Box.h.
static double Cubic_Bounding_Box::UtilDivideSafe | ( | const double | num, | |
const double | denom, | |||
const double | defaultRes | |||
) | [inline, static, protected] |
Does safe dividing. Code origin from Shell.
num | The number to divide | |
denom | The number to divide by | |
defaultRes | The number to return when denom==0 |
Definition at line 145 of file Cubic_Bounding_Box.h.
Referenced by BBEdgeIntersect().
static bool Cubic_Bounding_Box::BBOverlap | ( | const double * | bb1Min, | |
const double * | bb1Max, | |||
const double * | bb2Min, | |||
const double * | bb2Max, | |||
const int | dim | |||
) | [inline, static, protected] |
Calculates if two bounding boxes overlap. Code origin from Shell.
Definition at line 150 of file Cubic_Bounding_Box.h.
References _SHELL_CODE_MOD.
Referenced by intersects(), and lineIntersect().
static bool Cubic_Bounding_Box::BBEdgeIntersect | ( | const int | dim, | |
const double * | point1, | |||
const double * | point2, | |||
const double * | minBB, | |||
const double * | maxBB, | |||
const int | dir, | |||
const double | fixed_val | |||
) | [inline, static, protected] |
Function which checks if a line intersect a given edge of a given bounding box. Code origin from Shell.
Definition at line 189 of file Cubic_Bounding_Box.h.
References intersect(), and UtilDivideSafe().
Referenced by lineIntersect().
virtual void Cubic_Bounding_Box::writeToFile | ( | ofstream & | ofs | ) | const [inline, virtual] |
Outputs the first 2 coordinate pairs to a single line to a given stream as follows: "min_0 min_1 min_2 max_0 max_1 max_2"
ofs | Reference to the output file stream |
Implements Bounding_Box< Cubic_Bounding_Box >.
Reimplemented in Cubic_Bounding_Box_Container.
Definition at line 386 of file Cubic_Bounding_Box.h.
Referenced by R_tree< r_tree_variation >::writeTreeToFile().
virtual bool Cubic_Bounding_Box::lineIntersect | ( | const vector< double > & | start, | |
const vector< double > & | end | |||
) | const [inline, virtual] |
Does full line-segment intersection checking against the current bounding box.
start | Reference to the starting point of the line segment. | |
end | Reference to the ending point of the line segment. |
Implements Bounding_Box< Cubic_Bounding_Box >.
Definition at line 401 of file Cubic_Bounding_Box.h.
References _maxs, _mins, BBEdgeIntersect(), BBOverlap(), contains(), and intersect().
virtual void Cubic_Bounding_Box::clear | ( | ) | [inline, virtual] |
Empties the current bounding box
Implements Bounding_Box< Cubic_Bounding_Box >.
Definition at line 528 of file Cubic_Bounding_Box.h.
Referenced by FPB_tree< base_tree >::bulkLoad(), Cubic_Bounding_Box(), and R_tree< r_tree_variation >::updateMBRLocal().
virtual void Cubic_Bounding_Box::become | ( | const Cubic_Bounding_Box * | toCopy | ) | [inline, virtual] |
Function to let the current bounding box take on the exact shape of another given bounding box.
toCopy | Pointer to the bounding box to be copied. |
Implements Bounding_Box< Cubic_Bounding_Box >.
Definition at line 538 of file Cubic_Bounding_Box.h.
References _maxs, _mins, and toString().
Referenced by Cubic_Bounding_Box(), Basic_R_tree::linearSplitElements(), Basic_R_tree::linearSplitNodes(), Basic_R_tree::quadraticSplitElements(), Basic_R_tree::quadraticSplitNodes(), and unite().
double Cubic_Bounding_Box::getMinCoordinateOnDimension | ( | unsigned int | i | ) | const [inline] |
Minimum coordinate access function.
i | The requested coordinate. |
Definition at line 572 of file Cubic_Bounding_Box.h.
References _mins.
double Cubic_Bounding_Box::getMaxCoordinateOnDimension | ( | unsigned int | i | ) | const [inline] |
Maximum coordinate accessor
i | The requested coordinate. |
Definition at line 580 of file Cubic_Bounding_Box.h.
References _maxs.
virtual bool Cubic_Bounding_Box::isEmpty | ( | ) | const [inline, virtual] |
Checks if the bounding box is empty.
Implements Bounding_Box< Cubic_Bounding_Box >.
Definition at line 587 of file Cubic_Bounding_Box.h.
Referenced by contains(), intersect(), intersects(), unionWith(), and unite().
virtual void Cubic_Bounding_Box::getCenterCoordinate | ( | vector< double > * | into | ) | const [inline, virtual] |
Calculates and puts the center coordinate of the currect bounding box into a vector pointed to by an input parameter.
Note that the vector pointed to does not have to have the right dimensions; this will be enforced by this method (via resize).
into | A pointer to the vector where to store the center coordinate. |
Implements Bounding_Box< Cubic_Bounding_Box >.
Definition at line 600 of file Cubic_Bounding_Box.h.
Referenced by Hilbert_R_tree::insert(), and Hilbert_TGSinsert_tree< base_tree >::insertionSort().
virtual bool Cubic_Bounding_Box::intersects | ( | const Cubic_Bounding_Box & | other | ) | const [inline, virtual] |
Checks if two hypercubic bounding boxes intersect.
other | The other bounding box. |
Implements Bounding_Box< Cubic_Bounding_Box >.
Definition at line 618 of file Cubic_Bounding_Box.h.
References _maxs, _mins, BBOverlap(), and isEmpty().
Referenced by R_tree< r_tree_variation >::containedIn(), and Basic_R_tree::search().
virtual bool Cubic_Bounding_Box::contains | ( | const Point & | x | ) | const [inline, virtual] |
Checks if a given point is contained within this hypercube.
x | The given point x. |
Implements Bounding_Box< Cubic_Bounding_Box >.
Definition at line 655 of file Cubic_Bounding_Box.h.
References _maxs, _mins, Point::getCoordinate(), Point::getDimension(), and isEmpty().
virtual bool Cubic_Bounding_Box::contains | ( | const Cubic_Bounding_Box & | other | ) | const [inline, virtual] |
Function which checks if a given bounding box is completely contained within the current one.
other | Reference to a given other bounding box to check containment for. |
Implements Bounding_Box< Cubic_Bounding_Box >.
Definition at line 685 of file Cubic_Bounding_Box.h.
References _maxs, _mins, and contains().
virtual void Cubic_Bounding_Box::unite | ( | const Cubic_Bounding_Box * | other | ) | [inline, virtual] |
Implements Bounding_Box< Cubic_Bounding_Box >.
Definition at line 690 of file Cubic_Bounding_Box.h.
References _maxs, _mins, become(), and isEmpty().
Referenced by TGS_tree< base_tree >::BestBinarySplit(), RTGS_tree< base_tree >::BestBinarySplit(), TGS_tree< base_tree >::BulkLoadChunk(), RTGS_tree< base_tree >::BulkLoadChunk(), Basic_R_tree::linearSplitElements(), and R_tree< r_tree_variation >::updateMBRLocal().
virtual Cubic_Bounding_Box Cubic_Bounding_Box::unionWith | ( | const Cubic_Bounding_Box & | other | ) | const [inline, virtual] |
Returns the union between two cubic bounding boxes.
other | The second bounding box. |
Implements Bounding_Box< Cubic_Bounding_Box >.
Definition at line 720 of file Cubic_Bounding_Box.h.
References _maxs, _mins, Cubic_Bounding_Box(), isEmpty(), temp1, and temp2.
Referenced by R_tree< r_tree_variation >::areaEnlargement(), R_tree< r_tree_variation >::deadSpace(), operator &&(), Basic_R_tree::quadraticSplitElements(), and Basic_R_tree::quadraticSplitNodes().
virtual Cubic_Bounding_Box Cubic_Bounding_Box::intersect | ( | const Cubic_Bounding_Box & | other | ) | const [inline, virtual] |
Returns the intersection between two cubic bounding boxes.
other | The second bounding box. |
Implements Bounding_Box< Cubic_Bounding_Box >.
Definition at line 765 of file Cubic_Bounding_Box.h.
References _maxs, _mins, Cubic_Bounding_Box(), isEmpty(), temp1, temp2, and toString().
Referenced by BBEdgeIntersect(), TGS2_tree< base_tree >::cost_function(), lineIntersect(), and operator||().
Ordering< Cubic_Bounding_Box > * Cubic_Bounding_Box::getDefaultOrdering | ( | ) | [static] |
Function returning the default ordering for the current bounding box.
Reimplemented from Bounding_Box< Cubic_Bounding_Box >.
Reimplemented in Cubic_Bounding_Box_Container.
Definition at line 36 of file Cubic_Bounding_Box.cpp.
References DIST_ORDERING.
vector< Ordering< Cubic_Bounding_Box > * > Cubic_Bounding_Box::getOrderings | ( | ) | [static] |
Function returning a set of orderings on the current type of bounding box. Typically used by the TGS bulkloading algorithm.
Reimplemented from Bounding_Box< Cubic_Bounding_Box >.
Reimplemented in Cubic_Bounding_Box_Container.
Definition at line 40 of file Cubic_Bounding_Box.cpp.
References LCX_ORDERING, LCY_ORDERING, and LCZ_ORDERING.
virtual string Cubic_Bounding_Box::toString | ( | ) | const [inline, virtual] |
Method to print the bounding box as a string. Commonly used for debugging purposes.
Implements Bounding_Box< Cubic_Bounding_Box >.
Definition at line 834 of file Cubic_Bounding_Box.h.
Referenced by become(), intersect(), Basic_R_tree::linearSplitElements(), Basic_R_tree::linearSplitNodes(), and operator<<().
virtual unsigned int Cubic_Bounding_Box::getDimension | ( | ) | const [inline, virtual] |
Gets the dimension of the current bounding box.
Implements Bounding_Box< Cubic_Bounding_Box >.
Definition at line 848 of file Cubic_Bounding_Box.h.
References _mins.
Referenced by Basic_R_tree::handleOverflow().
virtual bool Cubic_Bounding_Box::isDefining | ( | Cubic_Bounding_Box * | other | ) | const [inline, virtual] |
Returns whether or not a given bounding box is defining for this bounding box. A bounding box X is defining for Y iff Y may change if X is not contained in Y -- see the report.
other | Pointer to a given other bounding box. |
Implements Bounding_Box< Cubic_Bounding_Box >.
Definition at line 859 of file Cubic_Bounding_Box.h.
friend class CubicLowCoorOrdering< 0, Cubic_Bounding_Box > [friend] |
The bounding box semi-orderings need to be able to access protected elements
Definition at line 48 of file Cubic_Bounding_Box.h.
friend class CubicLowCoorOrdering< 1, Cubic_Bounding_Box > [friend] |
The bounding box semi-orderings need to be able to access protected elements
Definition at line 53 of file Cubic_Bounding_Box.h.
friend class CubicLowCoorOrdering< 2, Cubic_Bounding_Box > [friend] |
The bounding box semi-orderings need to be able to access protected elements
Definition at line 58 of file Cubic_Bounding_Box.h.
friend class DistOrdering< Cubic_Bounding_Box > [friend] |
The bounding box semi-orderings need to be able to access protected elements
Definition at line 63 of file Cubic_Bounding_Box.h.
friend class Bisection_Tree [friend] |
Definition at line 66 of file Cubic_Bounding_Box.h.
friend class Cart [friend] |
Definition at line 67 of file Cubic_Bounding_Box.h.
friend class Basic_R_tree [friend] |
Definition at line 68 of file Cubic_Bounding_Box.h.
vector< double > Cubic_Bounding_Box::temp1 = vector< double >( 3 ) [static, protected] |
A static vector cache used by some methods. This is faster than constantly renewing vectors within those methods
Definition at line 124 of file Cubic_Bounding_Box.h.
Referenced by intersect(), and unionWith().
vector< double > Cubic_Bounding_Box::temp2 = vector< double >( 3 ) [static, protected] |
A static vector cache used by some methods. This is faster than constantly renewing vectors within those methods
Definition at line 127 of file Cubic_Bounding_Box.h.
Referenced by intersect(), and unionWith().
vector<double> Cubic_Bounding_Box::_mins [protected] |
Current minimum bounds on each dimension.
Definition at line 130 of file Cubic_Bounding_Box.h.
Referenced by become(), clear(), contains(), Cubic_Bounding_Box(), Cubic_Bounding_Box_Container::Cubic_Bounding_Box_Container(), getCenterCoordinate(), getDimension(), getMinCoordinateOnDimension(), intersect(), intersects(), isDefining(), isEmpty(), Basic_R_tree::linearSplitElements(), Basic_R_tree::linearSplitNodes(), lineIntersect(), toString(), unionWith(), unite(), Cart::Volume(), Cubic_Bounding_Box_Container::writeToFile(), and writeToFile().
vector<double> Cubic_Bounding_Box::_maxs [protected] |
Current maximum bounds on each dimension.
Definition at line 133 of file Cubic_Bounding_Box.h.
Referenced by become(), clear(), contains(), Cubic_Bounding_Box(), Cubic_Bounding_Box_Container::Cubic_Bounding_Box_Container(), getCenterCoordinate(), getMaxCoordinateOnDimension(), intersect(), intersects(), isDefining(), isEmpty(), lineIntersect(), toString(), unionWith(), unite(), Cart::Volume(), Cubic_Bounding_Box_Container::writeToFile(), and writeToFile().
CubicLowCoorOrdering< 0, Cubic_Bounding_Box > Cubic_Bounding_Box::LCX_ORDERING = CubicLowCoorOrdering< 0, Cubic_Bounding_Box >() [static] |
The low-coordinate ordering along the x-direction
Definition at line 362 of file Cubic_Bounding_Box.h.
Referenced by getOrderings().
CubicLowCoorOrdering< 1, Cubic_Bounding_Box > Cubic_Bounding_Box::LCY_ORDERING = CubicLowCoorOrdering< 1, Cubic_Bounding_Box >() [static] |
The low-coordinate ordering along the y-direction
Definition at line 365 of file Cubic_Bounding_Box.h.
Referenced by getOrderings().
CubicLowCoorOrdering< 2, Cubic_Bounding_Box > Cubic_Bounding_Box::LCZ_ORDERING = CubicLowCoorOrdering< 2, Cubic_Bounding_Box >() [static] |
The low-coordinate ordering along the z-direction
Definition at line 368 of file Cubic_Bounding_Box.h.
Referenced by getOrderings().
DistOrdering< Cubic_Bounding_Box > Cubic_Bounding_Box::DIST_ORDERING = DistOrdering< Cubic_Bounding_Box >() [static] |
The "distance-from-(0,0,0)"-ordering
Definition at line 371 of file Cubic_Bounding_Box.h.
Referenced by getDefaultOrdering().