CCCoreLib 31 May 2022
CloudCompare Core algorithms
|
3D Vector (templated version) More...
#include <CCGeom.h>
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. | |
Vector3Tpl & | operator+= (const Vector3Tpl &v) |
In-place addition operator. | |
Vector3Tpl & | operator-= (const Vector3Tpl &v) |
In-place subtraction operator. | |
Vector3Tpl & | operator*= (Type v) |
In-place multiplication (by a scalar) operator. | |
Vector3Tpl & | operator/= (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. | |
Tuple3Tpl & | operator+= (const Tuple3Tpl &v) |
In-place addition operator. | |
Tuple3Tpl & | operator-= (const Tuple3Tpl &v) |
In-place subtraction operator. | |
Tuple3Tpl & | operator*= (Type v) |
In-place multiplication (by a scalar) operator. | |
Tuple3Tpl & | operator/= (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] | |
}; | |
3D Vector (templated version)
|
inline |
Default constructor.
Inits vector to (0, 0, 0).
|
inline |
Constructor from a triplet of coordinates.
Inits vector to (x,y,z).