Graphite Version 3
An experimental 3D geometry processing program
Loading...
Searching...
No Matches
GEO::vecng< 3, T > Class Template Reference

Specialization of class vecng for DIM == 3. More...

#include <geogram/basic/vecg.h>

Public Types

typedef vecng< dim, T > vector_type
 This vector type.
 
typedef T value_type
 The type of the vector coordinates.
 

Public Member Functions

 vecng ()
 Default vector constructor.
 
 vecng (const T &x_in, const T &y_in, const T &z_in)
 Constructs a vector from coordinates.
 
 vecng (T &&x_in, T &&y_in, T &&z_in)
 Constructs a vector from coordinates.
 
 vecng (const vecng< 3, T > &rhs)=default
 
 vecng (vecng< 3, T > &&rhs)=default
 
template<class T2 >
 vecng (const vecng< dim, T2 > &v)
 Constructs a vector by copy.
 
template<class T2 >
 vecng (const T2 *v)
 Constructs a vector from an array.
 
 vecng (const std::initializer_list< T > &Vi)
 
vecng< 3, T > & operator= (const vecng< 3, T > &rhs)=default
 
vecng< 3, T > & operator= (vecng< 3, T > &&rhs)=default
 
template<typename A , typename B >
 vecng (const vecng< 2, A > &_xy, B _z)
 Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
 
template<typename A , typename B >
 vecng (const vecng< 2, A > &_xy, const vecng< 1, B > &_z)
 Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
 
template<typename A , typename B >
 vecng (A _x, const vecng< 2, B > &_yz)
 Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
 
template<typename A , typename B >
 vecng (const vecng< 1, A > &_x, const vecng< 2, B > &_yz)
 Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
 
template<typename U >
 vecng (vecng< 4, U > const &v)
 Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)
 
length2 () const
 Gets the squared length of the vector.
 
length () const
 Gets the length of the vector.
 
distance2 (const vector_type &v) const
 
distance (const vector_type &v) const
 
vector_typeoperator+= (const vector_type &v)
 
vector_typeoperator-= (const vector_type &v)
 
template<class T2 >
vector_typeoperator*= (T2 s)
 Multiplies by a scalar in place.
 
template<class T2 >
vector_typeoperator/= (T2 s)
 Divides by a scalar in place.
 
vector_type operator+ (const vector_type &v) const
 
vector_type operator- (const vector_type &v) const
 
template<class T2 >
vector_type operator/ (T2 s) const
 Divides a vector by a scalar.
 
vector_type operator- () const
 Negates a vector.
 
index_t dimension () const
 Gets the vector dimension.
 
T * data ()
 Gets modifiable vector data.
 
const T * data () const
 Gets non-modifiable vector data.
 
T & operator[] (index_t i)
 Gets a modifiable vector coordinate.
 
const T & operator[] (index_t i) const
 Gets a non-modifiable vector coordinate.
 
void optimize ()
 Optimizes coordinate representation.
 

Public Attributes

x
 Vector x coordinate.
 
y
 Vector y coordinate.
 
z
 Vector z coordinate.
 

Static Public Attributes

static constexpr index_t dim = 3
 The dimension of the vector.
 

Detailed Description

template<class T>
class GEO::vecng< 3, T >

Specialization of class vecng for DIM == 3.

See also
vecng

Definition at line 773 of file vecg.h.

Member Typedef Documentation

◆ value_type

template<class T >
typedef T GEO::vecng< 3, T >::value_type

The type of the vector coordinates.

Definition at line 782 of file vecg.h.

◆ vector_type

template<class T >
typedef vecng<dim, T> GEO::vecng< 3, T >::vector_type

This vector type.

Definition at line 779 of file vecg.h.

Constructor & Destructor Documentation

◆ vecng() [1/11]

template<class T >
GEO::vecng< 3, T >::vecng ( )
inline

Default vector constructor.

All coordinates are initialized to 0 (zero).

Definition at line 785 of file vecg.h.

◆ vecng() [2/11]

template<class T >
GEO::vecng< 3, T >::vecng ( const T &  x_in,
const T &  y_in,
const T &  z_in 
)
inline

Constructs a vector from coordinates.

Parameters
[in]x_in,y_in,z_inreferences to vector coordinates

Definition at line 795 of file vecg.h.

◆ vecng() [3/11]

template<class T >
GEO::vecng< 3, T >::vecng ( T &&  x_in,
T &&  y_in,
T &&  z_in 
)
inline

Constructs a vector from coordinates.

Parameters
[in]x_in,y_in,z_invector coordinates as rvalues

Definition at line 805 of file vecg.h.

◆ vecng() [4/11]

template<class T >
template<class T2 >
GEO::vecng< 3, T >::vecng ( const vecng< dim, T2 > &  v)
inlineexplicit

Constructs a vector by copy.

This copies coordinates of vector v to this vector. The type T2 of the coordinates in v must be convertible to the type T of this vector.

Parameters
[in]van vector of same dimension with coordinates of type T2
Template Parameters
T2the type of coordinates in vector v

Definition at line 816 of file vecg.h.

◆ vecng() [5/11]

template<class T >
template<class T2 >
GEO::vecng< 3, T >::vecng ( const T2 *  v)
inlineexplicit

Constructs a vector from an array.

This copies coordinates the first DIM coordinates of array v to this vector. The type T2 of the coordinates in v must be convertible to the type T of this vector.

Parameters
[in]van array of values of type T2
Template Parameters
T2the type of coordinates in vector v

Definition at line 824 of file vecg.h.

◆ vecng() [6/11]

template<class T >
GEO::vecng< 3, T >::vecng ( const std::initializer_list< T > &  Vi)
inline

Definition at line 831 of file vecg.h.

◆ vecng() [7/11]

template<typename T >
template<typename A , typename B >
GEO::vecng< 3, T >::vecng ( const vecng< 2, A > &  _xy,
_z 
)

Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)

Definition at line 1454 of file vecg.h.

◆ vecng() [8/11]

template<typename T >
template<typename A , typename B >
GEO::vecng< 3, T >::vecng ( const vecng< 2, A > &  _xy,
const vecng< 1, B > &  _z 
)

Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)

Definition at line 1462 of file vecg.h.

◆ vecng() [9/11]

template<typename T >
template<typename A , typename B >
GEO::vecng< 3, T >::vecng ( _x,
const vecng< 2, B > &  _yz 
)

Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)

Definition at line 1470 of file vecg.h.

◆ vecng() [10/11]

template<typename T >
template<typename A , typename B >
GEO::vecng< 3, T >::vecng ( const vecng< 1, A > &  _x,
const vecng< 2, B > &  _yz 
)

Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)

Definition at line 1478 of file vecg.h.

◆ vecng() [11/11]

template<typename T >
template<typename U >
GEO::vecng< 3, T >::vecng ( vecng< 4, U > const &  v)
explicit

Explicit conversions (From section 5.4.1 Conversion and scalar constructors of GLSL 1.30.08 specification)

Definition at line 1486 of file vecg.h.

Member Function Documentation

◆ data() [1/2]

template<class T >
T * GEO::vecng< 3, T >::data ( )
inline

Gets modifiable vector data.

Returns
a pointer to the first element of the vector

Definition at line 954 of file vecg.h.

◆ data() [2/2]

template<class T >
const T * GEO::vecng< 3, T >::data ( ) const
inline

Gets non-modifiable vector data.

Returns
a const pointer to the first element of the vector

Definition at line 959 of file vecg.h.

◆ dimension()

template<class T >
index_t GEO::vecng< 3, T >::dimension ( ) const
inline

Gets the vector dimension.

Returns
the value of DIM

Definition at line 949 of file vecg.h.

◆ distance()

template<class T >
T GEO::vecng< 3, T >::distance ( const vector_type v) const
inline

Definition at line 889 of file vecg.h.

◆ distance2()

template<class T >
T GEO::vecng< 3, T >::distance2 ( const vector_type v) const
inline

Definition at line 881 of file vecg.h.

◆ length()

template<class T >
T GEO::vecng< 3, T >::length ( ) const
inline

Gets the length of the vector.

Definition at line 876 of file vecg.h.

◆ length2()

template<class T >
T GEO::vecng< 3, T >::length2 ( ) const
inline

Gets the squared length of the vector.

Definition at line 871 of file vecg.h.

◆ operator*=()

template<class T >
template<class T2 >
vector_type & GEO::vecng< 3, T >::operator*= ( T2  s)
inline

Multiplies by a scalar in place.

Multiplies this vector coordinates by value s. The type T2 of s must be convertible to the type T of this vector coordinates.

Parameters
[in]sa value of type T2
Template Parameters
T2the type of value s
Returns
a reference to this vector

Definition at line 911 of file vecg.h.

◆ operator+()

template<class T >
vector_type GEO::vecng< 3, T >::operator+ ( const vector_type v) const
inline

Definition at line 928 of file vecg.h.

◆ operator+=()

template<class T >
vector_type & GEO::vecng< 3, T >::operator+= ( const vector_type v)
inline

Definition at line 894 of file vecg.h.

◆ operator-() [1/2]

template<class T >
vector_type GEO::vecng< 3, T >::operator- ( ) const
inline

Negates a vector.

Builds a vector by negating coordinates of this vector.

Returns
the result vector (-this)

Definition at line 944 of file vecg.h.

◆ operator-() [2/2]

template<class T >
vector_type GEO::vecng< 3, T >::operator- ( const vector_type v) const
inline

Definition at line 933 of file vecg.h.

◆ operator-=()

template<class T >
vector_type & GEO::vecng< 3, T >::operator-= ( const vector_type v)
inline

Definition at line 902 of file vecg.h.

◆ operator/()

template<class T >
template<class T2 >
vector_type GEO::vecng< 3, T >::operator/ ( T2  s) const
inline

Divides a vector by a scalar.

Builds a vector by dividing this vector coordinates by value s. The type T2 of s must be convertible to the type T of this vector coordinates.

Parameters
[in]sa value of type T2
Template Parameters
T2the type of value s
Returns
the result vector (this / s)

Definition at line 939 of file vecg.h.

◆ operator/=()

template<class T >
template<class T2 >
vector_type & GEO::vecng< 3, T >::operator/= ( T2  s)
inline

Divides by a scalar in place.

Divides this vector coordinates by value s. The type T2 of s must be convertible to the type T of this vector coordinates.

Parameters
[in]sa value of type T2
Template Parameters
T2the type of value s
Returns
a reference to this vector

Definition at line 920 of file vecg.h.

◆ operator[]() [1/2]

template<class T >
T & GEO::vecng< 3, T >::operator[] ( index_t  i)
inline

Gets a modifiable vector coordinate.

Parameters
[in]iindex of the coordinate
Returns
a reference to coordinate at index i

Definition at line 964 of file vecg.h.

◆ operator[]() [2/2]

template<class T >
const T & GEO::vecng< 3, T >::operator[] ( index_t  i) const
inline

Gets a non-modifiable vector coordinate.

Parameters
[in]iindex of the coordinate
Returns
a const reference to coordinate at index i

Definition at line 970 of file vecg.h.

◆ optimize()

template<class T >
void GEO::vecng< 3, T >::optimize ( )
inline

Optimizes coordinate representation.

Definition at line 976 of file vecg.h.

Member Data Documentation

◆ dim

template<class T >
constexpr index_t GEO::vecng< 3, T >::dim = 3
staticconstexpr

The dimension of the vector.

Definition at line 776 of file vecg.h.

◆ x

template<class T >
T GEO::vecng< 3, T >::x

Vector x coordinate.

Definition at line 983 of file vecg.h.

◆ y

template<class T >
T GEO::vecng< 3, T >::y

Vector y coordinate.

Definition at line 985 of file vecg.h.

◆ z

template<class T >
T GEO::vecng< 3, T >::z

Vector z coordinate.

Definition at line 987 of file vecg.h.


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