$darkmode
VCG Library
Public Types | Protected Attributes | List of all members
vcg::Point3< P3ScalarType > Class Template Reference

Public Types

enum  { Dimension = 3 }
 
typedef P3ScalarType ScalarType
 

Public Member Functions

Data Access.

access to data is done by overloading of [] or explicit naming of coords (x,y,z)

P3ScalarType & operator[] (const int i)
 
const P3ScalarType & operator[] (const int i) const
 
const P3ScalarType & X () const
 
const P3ScalarType & Y () const
 
const P3ScalarType & Z () const
 
P3ScalarType & X ()
 
P3ScalarType & Y ()
 
P3ScalarType & Z ()
 
const P3ScalarType * V () const
 
P3ScalarType * V ()
 
P3ScalarType & V (const int i)
 
const P3ScalarType & V (const int i) const
 
Classical overloading of operators
Point3 operator+ (Point3 const &p) const
 
Point3 operator- (Point3 const &p) const
 
Point3 operator* (const P3ScalarType s) const
 
Point3 operator/ (const P3ScalarType s) const
 
P3ScalarType operator* (Point3 const &p) const
 Dot product.
 
P3ScalarType dot (const Point3 &p) const
 
Point3 operator^ (Point3 const &p) const
 Cross product.
 
Point3operator+= (Point3 const &p)
 
Point3operator-= (Point3 const &p)
 
Point3operator*= (const P3ScalarType s)
 
Point3operator/= (const P3ScalarType s)
 
P3ScalarType Norm () const
 
P3ScalarType SquaredNorm () const
 
Point3Scale (const P3ScalarType sx, const P3ScalarType sy, const P3ScalarType sz)
 
Point3Scale (const Point3 &p)
 
Point3Normalize ()
 
void normalize (void)
 
Point3 normalized (void) const
 
void ToPolarRad (P3ScalarType &ro, P3ScalarType &theta, P3ScalarType &phi) const
 
void FromPolarRad (const P3ScalarType &ro, const P3ScalarType &theta, const P3ScalarType &phi)
 
Box3< P3ScalarType > GetBBox (Box3< P3ScalarType > &bb) const
 
size_t MaxCoeffId () const
 
Comparison Operators.

Note that the reverse z prioritized ordering, useful in many situations.

bool operator== (Point3 const &p) const
 
bool operator!= (Point3 const &p) const
 
bool operator< (Point3 const &p) const
 
bool operator> (Point3 const &p) const
 
bool operator<= (Point3 const &p) const
 
bool operator>= (Point3 const &p) const
 
Point3 operator- (void) const
 

Protected Attributes

P3ScalarType _v [3]
 The only data member. Hidden to user.
 

Standard Constructors and Initializers

No casting operators have been introduced to avoid automatic unattended (and costly) conversion between different point types

 Point3 ()
 
 Point3 (const P3ScalarType nx, const P3ScalarType ny, const P3ScalarType nz)
 
 Point3 (Point3 const &p)=default
 
template<class Q >
 Point3 (Point3< Q > const &p)
 
 Point3 (const P3ScalarType nv[3])
 
Point3operator= (Point3 const &p)=default
 
template<class Q >
Point3operator= (Point3< Q > const &p)
 
void SetZero ()
 
P3ScalarType Ext (const int i) const
 
template<class Q >
void Import (const Point3< Q > &b)
 
template<class EigenVector >
void FromEigenVector (const EigenVector &b)
 
template<class EigenVector >
void ToEigenVector (EigenVector &b) const
 
template<class EigenVector >
EigenVector ToEigenVector (void) const
 
template<class Q >
static Point3 Construct (const Point3< Q > &b)
 
template<class Q >
static Point3 Construct (const Q &P0, const Q &P1, const Q &P2)
 
static Point3 Construct (const Point3< ScalarType > &b)
 
static Point3 Zero (void)
 
static Point3 One (void)
 

Constructor & Destructor Documentation

◆ Point3() [1/2]

template<class P3ScalarType >
vcg::Point3< P3ScalarType >::Point3 ( Point3< P3ScalarType > const &  p)
inlinedefault

Default copy constructor

◆ Point3() [2/2]

template<class P3ScalarType >
template<class Q >
vcg::Point3< P3ScalarType >::Point3 ( Point3< Q > const &  p)
inline

Copy from Point with different template

Member Function Documentation

◆ Ext()

template<class P3ScalarType >
P3ScalarType vcg::Point3< P3ScalarType >::Ext ( const int  i) const
inline

Padding function: give a default 0 value to all the elements that are not in the [0..2] range. Useful for managing in a consistent way object that could have point2 / point3 / point4

◆ FromPolarRad()

template<class P3ScalarType >
void vcg::Point3< P3ScalarType >::FromPolarRad ( const P3ScalarType &  ro,
const P3ScalarType &  theta,
const P3ScalarType &  phi 
)
inline

Convert from polar coordinates to cartesian coordinates.

Theta is the azimuth angle and ranges between [0, 2PI) radians. Phi is the elevation angle (not the polar angle) and ranges between [-PI/2, PI/2] radians.

Note
Note that instead of the classical polar angle, which ranges between 0 and PI degrees, we opt for the elevation angle to obtain a more intuitive spherical coordinate system.

◆ operator=() [1/2]

template<class P3ScalarType >
Point3& vcg::Point3< P3ScalarType >::operator= ( Point3< P3ScalarType > const &  p)
inlinedefault

Default copy assignment

◆ operator=() [2/2]

template<class P3ScalarType >
template<class Q >
Point3& vcg::Point3< P3ScalarType >::operator= ( Point3< Q > const &  p)
inline

Copy assignment from Point with different template

◆ ToPolarRad()

template<class P3ScalarType >
void vcg::Point3< P3ScalarType >::ToPolarRad ( P3ScalarType &  ro,
P3ScalarType &  theta,
P3ScalarType &  phi 
) const
inline

Convert to polar coordinates from cartesian coordinates.

Theta is the azimuth angle and ranges between [0, 2PI) degrees. Phi is the elevation angle (not the polar angle) and ranges between [-PI/2, PI/2] degrees.

/note Note that instead of the classical polar angle, which ranges between 0 and PI degrees we opt for the elevation angle to obtain a more intuitive spherical coordinate system.


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