HyperPlot  v1
Bin and visualise multidimensional datasets
Public Member Functions | Private Member Functions | Private Attributes | List of all members
HyperCuboid Class Reference

Detailed Description

Definition at line 28 of file 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 HyperCuboidinflateCuboid (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< HyperPlanegetConnectedHyperPlanes (const HyperPoint &point) const
 
std::vector< HyperPlanegetConnectedHyperPlanes (const HyperPointSet &point) const
 
std::vector< HyperPlanegetBoundaryHyperPlanes () 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 HyperPointgetLowCorner () const
 
const HyperPointgetHighCorner () const
 
HyperPointgetLowCorner ()
 
HyperPointgetHighCorner ()
 
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
 

Constructor & Destructor Documentation

HyperCuboid::HyperCuboid ( int  dimension)

Most basic constructor where only the dimension of the cuboid is specified.

Definition at line 5 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 14 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 34 of file HyperCuboid.cpp.

HyperCuboid::~HyperCuboid ( )

Destructor

Definition at line 707 of file HyperCuboid.cpp.

Member Function Documentation

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 251 of file HyperCuboid.cpp.

HyperPoint HyperCuboid::getCenter ( ) const

Get the HyperPoint at the center of the HyperCuboid

Definition at line 92 of file HyperCuboid.cpp.

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 196 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 230 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 520 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 540 of file HyperCuboid.cpp.

const int& HyperCuboid::getDimension ( ) const
inline

get the dimensionality

Definition at line 45 of file HyperCuboid.h.

const HyperPoint& HyperCuboid::getHighCorner ( ) const
inline

return the high HyperPoint corner

Definition at line 89 of file HyperCuboid.h.

HyperPoint& HyperCuboid::getHighCorner ( )
inline

return the high HyperPoint corner

Definition at line 93 of file HyperCuboid.h.

const HyperPoint& HyperCuboid::getLowCorner ( ) const
inline

return the low HyperPoint corner

Definition at line 87 of file HyperCuboid.h.

HyperPoint& HyperCuboid::getLowCorner ( )
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 351 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 409 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 157 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 300 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 401 of file HyperCuboid.cpp.

HyperPoint HyperCuboid::getRandomPoint ( TRandom *  random = gRandom) const

Get a random point in the HyperCuboid (uses gRandom)

Definition at line 167 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 179 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 460 of file HyperCuboid.cpp.

HyperPoint HyperCuboid::getWidth ( ) const

Find width of the HyperCuboid as a HyperPoint

Definition at line 610 of file HyperCuboid.cpp.

double HyperCuboid::getWidth ( int  dim) const

Find the width of the HyperCuboid in a given dimension

Definition at line 616 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 79 of file HyperCuboid.cpp.

bool HyperCuboid::inVolume ( const HyperPoint coords) const

See if a HyperPoint is within the HyperCuboid volume

Definition at line 577 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 586 of file HyperCuboid.cpp.

bool HyperCuboid::operator!= ( const HyperCuboid other) const

See if two HyperCuboids are not the same

Definition at line 64 of file HyperCuboid.cpp.

bool HyperCuboid::operator== ( const HyperCuboid other) const

See if two HyperCuboids are the same

Definition at line 52 of file HyperCuboid.cpp.

void HyperCuboid::print ( std::ostream &  os = std::cout,
int  endline = 1 
) const

Print the HyperCuboid to given std::ostream

Definition at line 98 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 112 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 131 of file HyperCuboid.cpp.

bool HyperCuboid::setCorners ( const HyperPoint lowCorner,
const HyperPoint highCorner 
)

Set the upper and lower corners of the HyperCuboid

Definition at line 562 of file HyperCuboid.cpp.

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 686 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 698 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 655 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 624 of file HyperCuboid.cpp.

void HyperCuboid::updateFaceCash ( ) const
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 292 of file HyperCuboid.cpp.

double HyperCuboid::volume ( ) const

Find the volume of the HyperCuboid

Definition at line 602 of file HyperCuboid.cpp.

Member Data Documentation

int HyperCuboid::_dimension
private

The dimensionality of the cuboid

Definition at line 32 of file HyperCuboid.h.

std::vector<HyperPlane> HyperCuboid::_faces
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.

HyperPoint HyperCuboid::_highCorner
private

The higher corner of the cuboid

Definition at line 35 of file HyperCuboid.h.

HyperPoint HyperCuboid::_lowCorner
private

The lower corner of the cuboid

Definition at line 34 of file HyperCuboid.h.


The documentation for this class was generated from the following files: