Class representing an arbitrary-dimensional point. More...
#include <libhyperpoint.hpp>
Public Member Functions | |
hyperpoint (xsd__int size) | |
Constructs hyperpoint and allocates memory for 'size' floats. | |
hyperpoint (const hyperpoint &point) | |
Copy constructor. | |
virtual xsd__int | size () const |
return dimension of the hyperpoint | |
virtual void | initialize (int size) |
Initialize the hyperpoint to hold a point of given dimension. | |
virtual void | reset (void) |
Free up the hyperpoint. | |
virtual xsd__float & | operator[] (xsd__int i) const |
The [] operator. | |
virtual xsd__float | operator() (xsd__int i) const |
The () operator. | |
virtual hyperpoint & | operator= (const hyperpoint &point) |
The = operator. | |
virtual void | print () const |
Print content of hyperpoint to std::cout. | |
virtual void | print (std::ostream &printstream) const |
Print content of hyperpoint to std::ostream. | |
virtual double | norm2 () const |
square of euclidean norm of the hyperpoint | |
virtual hyperpoint | operator- (const hyperpoint &point) const |
Difference of two hyperpoints. | |
virtual bool | operator< (double threshold) const |
The < operator. | |
virtual double | dist2 (const hyperpoint &point) const |
square of Euclidean distance between hyperpoints | |
Public Attributes | |
xsd__float * | __ptr |
xsd__int | __size |
Class representing an arbitrary-dimensional point.
Used to set/get position/velocity/acceleration et cetera
Definition at line 26 of file libhyperpoint.hpp.
hyperpoint::hyperpoint | ( | xsd__int | size | ) |
Constructs hyperpoint and allocates memory for 'size' floats.
[in] | size | dimension of the hyperpoint |
Definition at line 42 of file libhyperpoint.cpp.
hyperpoint::hyperpoint | ( | const hyperpoint & | point | ) |
Copy constructor.
Definition at line 34 of file libhyperpoint.cpp.
double hyperpoint::dist2 | ( | const hyperpoint & | point | ) | const [virtual] |
square of Euclidean distance between hyperpoints
Definition at line 181 of file libhyperpoint.cpp.
void hyperpoint::initialize | ( | int | size | ) | [virtual] |
Initialize the hyperpoint to hold a point of given dimension.
Usually used when hyperpoint was created with empty constructor of after it has been reset()
[in] | size | dimension of the hyperpoint |
Definition at line 118 of file libhyperpoint.cpp.
double hyperpoint::norm2 | ( | ) | const [virtual] |
square of euclidean norm of the hyperpoint
Definition at line 140 of file libhyperpoint.cpp.
float hyperpoint::operator() | ( | xsd__int | i | ) | const [virtual] |
The () operator.
Returns the value at a particular index into the hyperpoint. Use when contents have to be read, without modification.
[in] | i | Index into the hyperpoint. Starts from 0 and goes till size() - 1 |
Definition at line 75 of file libhyperpoint.cpp.
hyperpoint hyperpoint::operator- | ( | const hyperpoint & | point | ) | const [virtual] |
Difference of two hyperpoints.
Returns a size() dimensional hyperpoint whose contents are the ABSOLUTE values of the difference between elements at each index. Can be considered to be a size() dimensional measure of the distance between two hyperpoints
Definition at line 160 of file libhyperpoint.cpp.
bool hyperpoint::operator< | ( | double | threshold | ) | const [virtual] |
The < operator.
Returns true if and only if every value in the hyperpoint is less than the threshold
[in] | threshold | the value against which each value of the hyperpoint is compared |
Definition at line 170 of file libhyperpoint.cpp.
hyperpoint & hyperpoint::operator= | ( | const hyperpoint & | point | ) | [virtual] |
The = operator.
Resets the hyperpoint and then makes it a copy of the hyperpoint on the RHS of the = sign
Definition at line 82 of file libhyperpoint.cpp.
float & hyperpoint::operator[] | ( | xsd__int | i | ) | const [virtual] |
The [] operator.
Returns a reference to the contents of the hyperpoint. Used when modifying the contents, like setting them to a value.
[in] | i | Index into the hyperpoint. Starts from 0 and goes till size() - 1 |
Definition at line 69 of file libhyperpoint.cpp.
void hyperpoint::print | ( | std::ostream & | printstream | ) | const [virtual] |
Print content of hyperpoint to std::ostream.
[in] | printstream | the stream to which the hyperpoint values will be printed |
Definition at line 106 of file libhyperpoint.cpp.
void hyperpoint::print | ( | ) | const [virtual] |
Print content of hyperpoint to std::cout.
Definition at line 94 of file libhyperpoint.cpp.
void hyperpoint::reset | ( | void | ) | [virtual] |
Free up the hyperpoint.
Deletes memory allocated and sets size to ZERO
Definition at line 130 of file libhyperpoint.cpp.
int hyperpoint::size | ( | ) | const [virtual] |
return dimension of the hyperpoint
Definition at line 63 of file libhyperpoint.cpp.