MINT2
|
#include <HyperCuboid.h>
Public Member Functions | |
const int & | getDimension () const |
HyperCuboid (int dimension) | |
HyperCuboid (const HyperPoint &lowCorner, const HyperPoint &highCorner) | |
HyperCuboid (int dimension, double low, double high) | |
void | print (std::ostream &os=std::cout, int endline=1) const |
HyperPoint | getCenter () const |
bool | inVolume (const HyperPoint &coords) const |
const HyperCuboid & | inflateCuboid (double percent) |
double | volume () const |
double | getPositiveIntersectionParameter (const HyperLine &line) const |
HyperPoint | getPositiveIntersectionPoint (const HyperLine &line) const |
double | getNegativeIntersectionParameter (const HyperLine &line) const |
HyperPoint | getNegativeIntersectionPoint (const HyperLine &line) const |
HyperPoint | getRandomPoint (TRandom *random=gRandom) const |
HyperPointSet | getRandomPoints (int nPoints=100, TRandom *random=gRandom) const |
std::vector< HyperPlane > | getConnectedHyperPlanes (const HyperPoint &point) const |
std::vector< HyperPlane > | getConnectedHyperPlanes (const HyperPointSet &point) const |
std::vector< HyperPlane > | getBoundaryHyperPlanes () const |
HyperPoint | getOppositePoint (const HyperPoint &point) const |
HyperPointSet | getConnectedVerticies (const HyperPointSet &pointSet) const |
HyperPointSet | getConnectedVerticies (const HyperPoint &point) const |
HyperPointSet | getVertices () const |
HyperPointSet | getEdgeCenters () const |
HyperCuboid | project (std::vector< int > dims) const |
HyperCuboid | projectOpposite (std::vector< int > dims) const |
bool | inVolume (const HyperPoint &coords, std::vector< int > dims) const |
const HyperPoint & | getLowCorner () const |
const HyperPoint & | getHighCorner () const |
HyperPoint & | getLowCorner () |
HyperPoint & | getHighCorner () |
HyperCuboid | splitAbove (int dimension, double fractionalSplitPoint) const |
HyperCuboid | splitBelow (int dimension, double fractionalSplitPoint) const |
HyperVolume | split (int dimension, double fractionalSplitPoint) const |
void | split (int dimension, double fractionalSplitPoint, HyperVolume &set) const |
HyperPoint | getWidth () const |
double | getWidth (int dim) const |
bool | setCorners (const HyperPoint &lowCorner, const HyperPoint &highCorner) |
bool | operator== (const HyperCuboid &other) const |
bool | operator != (const HyperCuboid &other) const |
~HyperCuboid () | |
Private Member Functions | |
void | updateFaceCash () const |
Private Attributes | |
int | _dimension |
HyperPoint | _lowCorner |
HyperPoint | _highCorner |
std::vector< HyperPlane > | _faces |
Definition at line 28 of file HyperCuboid.h.
HyperCuboid::HyperCuboid | ( | int | dimension | ) |
Most basic constructor where only the dimension of the cuboid is specified.
Definition at line 6 of file HyperCuboid.cpp.
HyperCuboid::HyperCuboid | ( | const HyperPoint & | lowCorner, |
const HyperPoint & | highCorner | ||
) |
Construct the HyperCuboid with two HyperPoints, one in the low corner, and one in the high corner
Definition at line 15 of file HyperCuboid.cpp.
HyperCuboid::HyperCuboid | ( | int | dimension, |
double | low, | ||
double | high | ||
) |
Construct the HyperCuboid with two HyperPoints (x, x, x ....) and (y, y, y ....)
Definition at line 35 of file HyperCuboid.cpp.
HyperCuboid::~HyperCuboid | ( | ) |
std::vector< HyperPlane > HyperCuboid::getBoundaryHyperPlanes | ( | ) | const |
Get all the HyperPlanes that define the ‘faces’ of the HyperCuboid. Note that nDim points are needed to define such HyperPlanes.
e.g. for a square the 'faces' are lines defined by 2 points for a cube the 'faces' are planes defined by 3 points
Definition at line 252 of file HyperCuboid.cpp.
HyperPoint HyperCuboid::getCenter | ( | ) | const |
std::vector< HyperPlane > HyperCuboid::getConnectedHyperPlanes | ( | const HyperPoint & | point | ) | const |
Give it a corner of the HyperCuboid and it will return all faces (HyperPlanes) connected to that corner. Note that nDim points are needed to define such a HyperPlane.
e.g. for a square the 'faces' are lines defined by 2 points for a cube the 'faces' are planes defined by 3 points
Definition at line 197 of file HyperCuboid.cpp.
std::vector< HyperPlane > HyperCuboid::getConnectedHyperPlanes | ( | const HyperPointSet & | point | ) | const |
Give it a corners of the HyperCuboid and it will return all faces (HyperPlanes) connected to that corner. Note that nDim points are needed to define such a HyperPlane.
e.g. for a square the 'faces' are lines defined by 2 points for a cube the 'faces' are planes defined by 3 points
This is done for all corners given in the HyperPointSet
Definition at line 231 of file HyperCuboid.cpp.
HyperPointSet HyperCuboid::getConnectedVerticies | ( | const HyperPointSet & | pointSet | ) | const |
If a vertex of the HyperCuboid is given, this finds all other verticies that are connected to that one by an edge. It does this for all HyperPoints in the HyperPointSet given.
For example, if you give it the top right corner of a square, it will return the top left and bottom right corners.
Definition at line 521 of file HyperCuboid.cpp.
HyperPointSet HyperCuboid::getConnectedVerticies | ( | const HyperPoint & | point | ) | const |
If a vertex of the HyperCuboid is given, this finds all other verticies that are connected to that one by an edge
For example, if you give it the top right corner of a square, it will return the top left and bottom right corners.
Definition at line 541 of file HyperCuboid.cpp.
|
inline |
get the dimensionality
Definition at line 45 of file HyperCuboid.h.
HyperPointSet HyperCuboid::getEdgeCenters | ( | ) | const |
Definition at line 416 of file HyperCuboid.cpp.
|
inline |
return the high HyperPoint corner
Definition at line 89 of file HyperCuboid.h.
|
inline |
return the high HyperPoint corner
Definition at line 93 of file HyperCuboid.h.
|
inline |
return the low HyperPoint corner
Definition at line 87 of file HyperCuboid.h.
|
inline |
return the low HyperPoint corner
Definition at line 91 of file HyperCuboid.h.
double HyperCuboid::getNegativeIntersectionParameter | ( | const HyperLine & | line | ) | const |
A HyperLine is parameterised by (v_1 + x.v_2). This finds one of the two points, x_-, where the HyperLine intersects a face of the HyperCuboid.
Definition at line 352 of file HyperCuboid.cpp.
HyperPoint HyperCuboid::getNegativeIntersectionPoint | ( | const HyperLine & | line | ) | const |
A HyperLine is parameterised by (v_1 + x.v_2). This finds one of the two points, (v_1 + x_-.v_2), where the HyperLine intersects a face of the HyperCuboid
Definition at line 410 of file HyperCuboid.cpp.
HyperPoint HyperCuboid::getOppositePoint | ( | const HyperPoint & | point | ) | const |
Get point on the opposite side of the HyperCuboid
Imagine a vector V going from the center of the HyperCuboid, C, to the given point. This returns C - V
Definition at line 158 of file HyperCuboid.cpp.
double HyperCuboid::getPositiveIntersectionParameter | ( | const HyperLine & | line | ) | const |
A HyperLine is parameterised by (v_1 + x.v_2). This finds one of the two points, x_+, where the HyperLine intersects a face of the HyperCuboid
Definition at line 301 of file HyperCuboid.cpp.
HyperPoint HyperCuboid::getPositiveIntersectionPoint | ( | const HyperLine & | line | ) | const |
A HyperLine is parameterised by (v_1 + x.v_2). This finds one of the two points, (v_1 + x_+.v_2), where the HyperLine intersects a face of the HyperCuboid
Definition at line 402 of file HyperCuboid.cpp.
HyperPoint HyperCuboid::getRandomPoint | ( | TRandom * | random = gRandom | ) | const |
Get a random point in the HyperCuboid (uses gRandom)
Definition at line 168 of file HyperCuboid.cpp.
HyperPointSet HyperCuboid::getRandomPoints | ( | int | nPoints = 100 , |
TRandom * | random = gRandom |
||
) | const |
Get a random point in the HyperCuboid (uses gRandom)
Definition at line 180 of file HyperCuboid.cpp.
HyperPointSet HyperCuboid::getVertices | ( | ) | const |
Get all verticies of the HyperCuboid with no repeats.
This is done by starting from one corner and following the edges to the other corners. This has to be done nDim times in order to get all the corners.
Definition at line 461 of file HyperCuboid.cpp.
HyperPoint HyperCuboid::getWidth | ( | ) | const |
double HyperCuboid::getWidth | ( | int | dim | ) | const |
Find the width of the HyperCuboid in a given dimension
Definition at line 617 of file HyperCuboid.cpp.
const HyperCuboid & HyperCuboid::inflateCuboid | ( | double | percent | ) |
Inflate the boundaries of the HyperCuboid by some percentage.
x_low_0' = x_low_0 - (x_high_0 - x_low_0) * percent
x_high_0' = x_high_0 + (x_high_0 - x_low_0) * percent
Definition at line 80 of file HyperCuboid.cpp.
bool HyperCuboid::inVolume | ( | const HyperPoint & | coords | ) | const |
See if a HyperPoint is within the HyperCuboid volume
Definition at line 578 of file HyperCuboid.cpp.
bool HyperCuboid::inVolume | ( | const HyperPoint & | coords, |
std::vector< int > | dims | ||
) | const |
See if a HyperPoint is within the HyperCuboid volume, but only for selected dimensions.
Definition at line 587 of file HyperCuboid.cpp.
bool HyperCuboid::operator != | ( | const HyperCuboid & | other | ) | const |
bool HyperCuboid::operator== | ( | const HyperCuboid & | other | ) | const |
void HyperCuboid::print | ( | std::ostream & | os = std::cout , |
int | endline = 1 |
||
) | const |
Print the HyperCuboid to given std::ostream
Definition at line 99 of file HyperCuboid.cpp.
HyperCuboid HyperCuboid::project | ( | std::vector< int > | dims | ) | const |
Project the HyperCuboid into a lower dimensional space. E.g. start with HyperCuboid defined by (0,-1,-2) , (0,+1,+2) and project over dimensions 0 and 2. This would return a HyperCuboid defined by (0,-2) , (0,+2)
Definition at line 113 of file HyperCuboid.cpp.
HyperCuboid HyperCuboid::projectOpposite | ( | std::vector< int > | dims | ) | const |
Project the HyperCuboid into a lower dimensional space. E.g. start with HyperCuboid defined by (0,-1,-2) , (0,+1,+2) and projectOpposite over dimensions 1. This would return a HyperCuboid defined by (0,-2) , (0,+2)
Definition at line 132 of file HyperCuboid.cpp.
bool HyperCuboid::setCorners | ( | const HyperPoint & | lowCorner, |
const HyperPoint & | highCorner | ||
) |
HyperVolume HyperCuboid::split | ( | int | dimension, |
double | fractionalSplitPoint | ||
) | const |
split the cuboid into two along the dimension given and return the resulting HyperCuboids in a HyperCuboidSet. The fractional split point [0,1] decides where (in that dimesnion) the split is
Definition at line 687 of file HyperCuboid.cpp.
void HyperCuboid::split | ( | int | dimension, |
double | fractionalSplitPoint, | ||
HyperVolume & | set | ||
) | const |
split the cuboid into two along the dimension given and append the resulting HyperCuboids to the HyperCuboidSet given. The fractional split point [0,1] decides where (in that dimesnion) the split is
Definition at line 699 of file HyperCuboid.cpp.
HyperCuboid HyperCuboid::splitAbove | ( | int | dimension, |
double | fractionalSplitPoint | ||
) | const |
split the cuboid into two along the dimension given and return the resulting HyperCuboid. The fractional split point [0,1] decides where (in that dimesnion) the split is
Definition at line 656 of file HyperCuboid.cpp.
HyperCuboid HyperCuboid::splitBelow | ( | int | dimension, |
double | fractionalSplitPoint | ||
) | const |
split the cuboid into two along the dimension given and return the resulting HyperCuboid. The fractional split point [0,1] decides where (in that dimesnion) the split is
Definition at line 625 of file HyperCuboid.cpp.
|
private |
It takes a while to find all the HyperPlanes (that define the faces of the HyperCuboid), so they are cashed using this function. Beware if you later change the corners of the HyperCuboid
Definition at line 293 of file HyperCuboid.cpp.
double HyperCuboid::volume | ( | ) | const |
|
private |
The dimensionality of the cuboid
Definition at line 32 of file HyperCuboid.h.
|
mutableprivate |
The HyperPlanes that define the faces of the cuboid. Dy default these are not filled, but if needed it's useful to cashe them here
Definition at line 39 of file HyperCuboid.h.
|
private |
The higher corner of the cuboid
Definition at line 35 of file HyperCuboid.h.
|
private |
The lower corner of the cuboid
Definition at line 34 of file HyperCuboid.h.