CCCoreLib 31 May 2022
CloudCompare Core algorithms
Public Member Functions | Static Public Member Functions | List of all members
Vector3Tpl< Type > Class Template Reference

3D Vector (templated version) More...

#include <CCGeom.h>

Inheritance diagram for Vector3Tpl< Type >:
Inheritance graph
[legend]
Collaboration diagram for Vector3Tpl< Type >:
Collaboration graph
[legend]

Public Member Functions

 Vector3Tpl ()
 Default constructor. More...
 
 Vector3Tpl (Type _x, Type _y, Type _z)
 Constructor from a triplet of coordinates. More...
 
 Vector3Tpl (const Type p[])
 Constructor from an array of 3 elements.
 
 Vector3Tpl (const Vector2Tpl< Type > &t2D, Type c)
 Constructor from a 2D vector (and a third value)
 
 operator Vector3Tpl< double > () const
 Cast operator to a double vector (no loss of precision, can be done silently)
 
Vector3Tpl< double > toDouble () const
 Cast operator to a double vector (explicit call version)
 
Vector3Tpl< float > toFloat () const
 Cast operator to a float vector (potential loss of precision, should be called explicitely)
 
Vector3Tpl< PointCoordinateType > toPC () const
 Cast operator to the default vector type (potential loss of precision, should be called explicitely)
 
Type dot (const Vector3Tpl &v) const
 Dot product.
 
Vector3Tpl cross (const Vector3Tpl &v) const
 Cross product.
 
Type norm2 () const
 Returns vector square norm.
 
double norm2d () const
 Returns vector square norm (forces double precision output)
 
Type norm () const
 Returns vector norm.
 
double normd () const
 Returns vector norm (forces double precision output)
 
void normalize ()
 Sets vector norm to unity.
 
Vector3Tpl orthogonal () const
 Returns a normalized vector which is orthogonal to this one.
 
Vector3Tpl operator- () const
 Inverse operator.
 
Vector3Tploperator+= (const Vector3Tpl &v)
 In-place addition operator.
 
Vector3Tploperator-= (const Vector3Tpl &v)
 In-place subtraction operator.
 
Vector3Tploperator*= (Type v)
 In-place multiplication (by a scalar) operator.
 
Vector3Tploperator/= (Type v)
 In-place division (by a scalar) operator.
 
Vector3Tpl operator+ (const Vector3Tpl &v) const
 Addition operator.
 
Vector3Tpl operator- (const Vector3Tpl &v) const
 Subtraction operator.
 
Vector3Tpl operator* (Type s) const
 Multiplication operator.
 
Vector3Tpl operator/ (Type s) const
 Division operator.
 
Vector3Tpl operator* (const Vector3Tpl &v) const
 Cross product operator.
 
Type operator&& (const Vector3Tpl &v) const
 Dot product operator.
 
Type & operator[] (unsigned i)
 Direct coordinate access.
 
const Type & operator[] (unsigned i) const
 Direct coordinate access (const)
 
Type angle_rad (const Vector3Tpl &v) const
 Returns the angle to another vector (in radians - in [0, pi].
 
double angle_radd (const Vector3Tpl &v) const
 
- Public Member Functions inherited from Tuple3Tpl< Type >
 Tuple3Tpl ()
 Default constructor. More...
 
 Tuple3Tpl (Type a, Type b, Type c)
 Constructor from a triplet of values. More...
 
 Tuple3Tpl (const Type p[])
 Constructor from an array of 3 elements.
 
Tuple3Tpl operator- () const
 Inverse operator.
 
Tuple3Tploperator+= (const Tuple3Tpl &v)
 In-place addition operator.
 
Tuple3Tploperator-= (const Tuple3Tpl &v)
 In-place subtraction operator.
 
Tuple3Tploperator*= (Type v)
 In-place multiplication (by a scalar) operator.
 
Tuple3Tploperator/= (Type v)
 In-place division (by a scalar) operator.
 
Tuple3Tpl operator+ (const Tuple3Tpl &v) const
 Addition operator.
 
Tuple3Tpl operator- (const Tuple3Tpl &v) const
 Subtraction operator.
 
Tuple3Tpl operator* (Type s) const
 Multiplication operator.
 
Tuple3Tpl operator/ (Type s) const
 Division operator.
 

Static Public Member Functions

static Vector3Tpl fromArray (const int a[3])
 Constructor from an int array.
 
static Vector3Tpl fromArray (const float a[3])
 Constructor from a float array.
 
static Vector3Tpl fromArray (const double a[3])
 Constructor from a double array.
 
static void vdivide (const Type p[], Type s, Type r[])
 
static void vdivide (Type p[], Type s)
 
static void vmultiply (const Type p[], Type s, Type r[])
 
static void vmultiply (Type p[], Type s)
 
static Type vdot (const Type p[], const Type q[])
 
static double vdotd (const Type p[], const Type q[])
 
static void vcross (const Type p[], const Type q[], Type r[])
 
static void vcopy (const Type p[], Type q[])
 
static void vset (Type p[], Type s)
 
static void vset (Type p[], Type x, Type y, Type z)
 
static void vadd (const Type p[], const Type q[], Type r[])
 
static void vsubstract (const Type p[], const Type q[], Type r[])
 
static void vcombination (Type a, const Type p[], Type b, const Type q[], Type r[])
 
static void vcombination (const Type p[], Type b, const Type q[], Type r[])
 
static void vnormalize (Type p[])
 
static Type vnorm2 (const Type p[])
 
static double vnorm2d (const Type p[])
 
static Type vdistance2 (const Type p[], const Type q[])
 
static double vdistance2d (const Type p[], const Type q[])
 
static Type vnorm (const Type p[])
 
static double vnormd (const Type p[])
 
static Type vdistance (const Type p[], const Type q[])
 
static double vdistanced (const Type p[], const Type q[])
 
static void vorthogonal (const Type p[], Type q[])
 
static Type vangle_rad (const Type p[], const Type q[])
 
static double vangle_radd (const Type p[], const Type q[])
 

Additional Inherited Members

- Public Attributes inherited from Tuple3Tpl< Type >
union {
   struct {
      Type   x
 
      Type   y
 
      Type   z
 
   } 
 
   Type   u [3]
 
}; 
 

Detailed Description

template<typename Type>
class Vector3Tpl< Type >

3D Vector (templated version)

Constructor & Destructor Documentation

◆ Vector3Tpl() [1/2]

template<typename Type >
Vector3Tpl< Type >::Vector3Tpl ( )
inline

Default constructor.

Inits vector to (0, 0, 0).

◆ Vector3Tpl() [2/2]

template<typename Type >
Vector3Tpl< Type >::Vector3Tpl ( Type  _x,
Type  _y,
Type  _z 
)
inline

Constructor from a triplet of coordinates.

Inits vector to (x,y,z).


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