3Depict
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Member Functions | Static Public Member Functions | Friends | List of all members
Point3D Class Reference

A 3D point data class storage. More...

#include <mathfuncs.h>

Public Member Functions

 Point3D ()
 Constructor. More...
 
 Point3D (float x, float y, float z)
 Constructor with initialising values. More...
 
 Point3D (float *v)
 
 Point3D (double *v)
 
void setValue (unsigned int ui, float val)
 Set by value (ith dim 0, 1 2) More...
 
void setValue (float fX, float fY, float fZ)
 Set all values. More...
 
void setValueArr (const float *val)
 Set by pointer. More...
 
void setISOSpherical (float theta, float phi, float r)
 
float getValue (unsigned int ui) const
 Get value of ith dim (0, 1, 2) More...
 
const float * getValueArr () const
 
void copyValueArr (float *value) const
 get into an array (note array must hold sizeof(float)*3 bytes of valid mem More...
 
void add (const Point3D &obj)
 Add a point to this, without generating a return value. More...
 
bool parse (const std::string &str)
 
bool operator== (const Point3D &pt) const
 Equality operator. More...
 
const Point3Doperator= (const Point3D &pt)
 assignment operator More...
 
const Point3Doperator+= (const Point3D &pt)
 += operator More...
 
const Point3Doperator-= (const Point3D &pt)
 += operator More...
 
const Point3D operator+ (float f) const
 
const Point3Doperator*= (const float scale)
 multiplication operator More...
 
const Point3D operator+ (const Point3D &pt) const
 Addition operator. More...
 
const Point3D operator* (float scale) const
 elemental multiplication More...
 
const Point3D operator* (const Point3D &pt) const
 multiplication More...
 
const Point3D operator/ (float scale) const
 Division. More...
 
const Point3D operator/ (const Point3D &p) const
 
const Point3D operator- (const Point3D &pt) const
 Subtraction. More...
 
const Point3D operator- () const
 returns a negative of the existing value More...
 
Point3D normalise ()
 make point unit magnitude, maintaining direction More...
 
float sqrDist (const Point3D &pt) const
 returns the square of distance another pt More...
 
float sqrMag () const
 overload for array indexing returns |pt|^2 More...
 
float mag () const
 
void sqrt ()
 Apply float->float transformation. More...
 
void sphericalAngles (float &theta, float &phi) const
 
float dotProd (const Point3D &pt) const
 Calculate the dot product of this and another pint. More...
 
Point3D crossProd (const Point3D &pt) const
 Calculate the cross product of this and another point. More...
 
float angle (const Point3D &pt) const
 Calculate the angle between two position vectors in radiians. More...
 
void extend (float distance)
 
float operator[] (unsigned int ui) const
 Retrieve by value. More...
 
float & operator[] (unsigned int ui)
 Retrieve element by referene. More...
 
bool insideBox (const Point3D &farPoint) const
 Is a given point stored inside a box bounded by orign and this pt? More...
 
bool insideBox (const Point3D &lowPoint, const Point3D &highPoint) const
 Tests if this point lies inside the rectangular prism. More...
 
void negate ()
 Makes each value negative of old value. More...
 
void transform3x3 (const float *matrix)
 
bool orthogonalise (const Point3D &p)
 

Static Public Member Functions

static Point3D centroid (const Point3D *p, unsigned int n)
 
static Point3D centroid (const std::vector< Point3D > &p)
 

Friends

std::ostream & operator<< (std::ostream &stream, const Point3D &)
 Output streaming operator. Users (x,y,z) as format for output. More...
 

Detailed Description

A 3D point data class storage.

A 3D point data class contains operator overloads and some basic mathematical functions

Constructor & Destructor Documentation

◆ Point3D() [1/4]

Point3D::Point3D ( )
inline

Constructor.

Referenced by applyQuaternion(), and rotatePointsToXYPlane().

Here is the caller graph for this function:

◆ Point3D() [2/4]

Point3D::Point3D ( float  x,
float  y,
float  z 
)
inline

Constructor with initialising values.

◆ Point3D() [3/4]

Point3D::Point3D ( float *  v)
inline

◆ Point3D() [4/4]

Point3D::Point3D ( double *  v)
inline

Member Function Documentation

◆ add()

void Point3D::add ( const Point3D obj)

Add a point to this, without generating a return value.

Referenced by getValueArr().

Here is the caller graph for this function:

◆ angle()

float Point3D::angle ( const Point3D pt) const

◆ centroid() [1/2]

Point3D Point3D::centroid ( const Point3D p,
unsigned int  n 
)
static

References ASSERT.

Referenced by centroid(), DrawQuad::getOrigin(), BoundCube::getPlaneIntersectVertices(), scatterPointsInPolygon(), and sqrt().

Here is the caller graph for this function:

◆ centroid() [2/2]

Point3D Point3D::centroid ( const std::vector< Point3D > &  p)
static

References centroid().

◆ copyValueArr()

void Point3D::copyValueArr ( float *  value) const

get into an array (note array must hold sizeof(float)*3 bytes of valid mem

References ASSERT.

Referenced by getValueArr(), and IonHit::makePosData().

Here is the caller graph for this function:

◆ crossProd()

Point3D Point3D::crossProd ( const Point3D pt) const

◆ dotProd()

float Point3D::dotProd ( const Point3D pt) const

◆ extend()

void Point3D::extend ( float  distance)

References ASSERT, normalise(), and sqrMag().

Referenced by sqrt().

Here is the caller graph for this function:

◆ getValue()

float Point3D::getValue ( unsigned int  ui) const
inline

Get value of ith dim (0, 1, 2)

Referenced by BoundCube::containsPt(), K3DNode::getAxisVal(), IonHit::getBoundCube(), K3DNode::getLocVal(), and BoundCube::intersects().

Here is the caller graph for this function:

◆ getValueArr()

const float* Point3D::getValueArr ( ) const
inline

◆ insideBox() [1/2]

bool Point3D::insideBox ( const Point3D farPoint) const

Is a given point stored inside a box bounded by orign and this pt?

returns true if this point is located inside (0,0,0) -> Farpoint assuming box shape (non zero edges return false) farPoint must be positive in all dim

Referenced by sqrt().

Here is the caller graph for this function:

◆ insideBox() [2/2]

bool Point3D::insideBox ( const Point3D lowPoint,
const Point3D highPoint 
) const

Tests if this point lies inside the rectangular prism.

Returns true if this point lies inside the box bounded by lowPoint and highPoint

◆ mag()

float Point3D::mag ( ) const

References sqrMag().

Referenced by getValueArr(), normalise(), and scatterPointsInPolygon().

Here is the caller graph for this function:

◆ negate()

void Point3D::negate ( )

Makes each value negative of old value.

Referenced by AnnotateFilter::refresh(), and sqrt().

Here is the caller graph for this function:

◆ normalise()

Point3D Point3D::normalise ( )

◆ operator*() [1/2]

const Point3D Point3D::operator* ( float  scale) const

elemental multiplication

Referenced by getValueArr().

Here is the caller graph for this function:

◆ operator*() [2/2]

const Point3D Point3D::operator* ( const Point3D pt) const

multiplication

◆ operator*=()

const Point3D & Point3D::operator*= ( const float  scale)

multiplication operator

Referenced by getValueArr().

Here is the caller graph for this function:

◆ operator+() [1/2]

const Point3D Point3D::operator+ ( float  f) const

Referenced by getValueArr().

Here is the caller graph for this function:

◆ operator+() [2/2]

const Point3D Point3D::operator+ ( const Point3D pt) const

Addition operator.

◆ operator+=()

const Point3D & Point3D::operator+= ( const Point3D pt)

+= operator

Referenced by getValueArr().

Here is the caller graph for this function:

◆ operator-() [1/2]

const Point3D Point3D::operator- ( const Point3D pt) const

Subtraction.

◆ operator-() [2/2]

const Point3D Point3D::operator- ( ) const

returns a negative of the existing value

Referenced by getValueArr().

Here is the caller graph for this function:

◆ operator-=()

const Point3D & Point3D::operator-= ( const Point3D pt)

+= operator

Referenced by getValueArr().

Here is the caller graph for this function:

◆ operator/() [1/2]

const Point3D Point3D::operator/ ( float  scale) const

Division.

Referenced by getValueArr().

Here is the caller graph for this function:

◆ operator/() [2/2]

const Point3D Point3D::operator/ ( const Point3D p) const

◆ operator=()

const Point3D & Point3D::operator= ( const Point3D pt)

assignment operator

Referenced by getValueArr().

Here is the caller graph for this function:

◆ operator==()

bool Point3D::operator== ( const Point3D pt) const

Equality operator.

Referenced by getValueArr().

Here is the caller graph for this function:

◆ operator[]() [1/2]

float Point3D::operator[] ( unsigned int  ui) const

Retrieve by value.

References ASSERT.

Referenced by sqrt().

Here is the caller graph for this function:

◆ operator[]() [2/2]

float & Point3D::operator[] ( unsigned int  ui)

Retrieve element by referene.

References ASSERT.

◆ orthogonalise()

bool Point3D::orthogonalise ( const Point3D p)

References crossProd(), normalise(), and sqrMag().

Referenced by AnnotateFilter::readState(), and sqrt().

Here is the caller graph for this function:

◆ parse()

bool Point3D::parse ( const std::string &  str)

◆ setISOSpherical()

void Point3D::setISOSpherical ( float  theta,
float  phi,
float  r 
)

Referenced by generate1DAxialDistHistSweep(), parse(), and setValueArr().

Here is the caller graph for this function:

◆ setValue() [1/2]

void Point3D::setValue ( unsigned int  ui,
float  val 
)
inline

◆ setValue() [2/2]

void Point3D::setValue ( float  fX,
float  fY,
float  fZ 
)
inline

Set all values.

◆ setValueArr()

void Point3D::setValueArr ( const float *  val)
inline

Set by pointer.

References setISOSpherical().

Referenced by parse(), and IonHit::setHit().

Here is the caller graph for this function:

◆ sphericalAngles()

void Point3D::sphericalAngles ( float &  theta,
float &  phi 
) const

References ASSERT, EQ_TOL, sphericalAngles(), and sqrMag().

Referenced by sphericalAngles(), and sqrt().

Here is the caller graph for this function:

◆ sqrDist()

float Point3D::sqrDist ( const Point3D pt) const

◆ sqrMag()

float Point3D::sqrMag ( ) const

◆ sqrt()

void Point3D::sqrt ( )
inline

Apply float->float transformation.

References angle(), centroid(), crossProd(), dotProd(), extend(), insideBox(), negate(), operator[](), orthogonalise(), sphericalAngles(), and transform3x3().

Referenced by rotatePointsToXYPlane(), and scatterPointsInPolygon().

Here is the caller graph for this function:

◆ transform3x3()

void Point3D::transform3x3 ( const float *  matrix)

Referenced by sqrt().

Here is the caller graph for this function:

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  stream,
const Point3D pt 
)
friend

Output streaming operator. Users (x,y,z) as format for output.

Referenced by getValueArr().


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