LevelS C++ support library  3.83
Public Member Functions | Public Attributes | Related Functions | List of all members
vec3_t< T > Class Template Reference

#include <vec3.h>

Public Member Functions

 vec3_t ()
 
 vec3_t (T xc, T yc, T zc)
 
void Set (T xc, T yc, T zc)
 
void set_z_phi (T z_, T phi)
 
void Normalize ()
 
Length () const
 
SquaredLength () const
 
const vec3_t operator- () const
 
void Flip ()
 
const vec3_t operator+ (const vec3_t &vec) const
 
vec3_toperator+= (const vec3_t &vec)
 
const vec3_t operator- (const vec3_t &vec) const
 
vec3_toperator-= (const vec3_t &vec)
 
const vec3_t operator* (T fact) const
 
const vec3_t operator/ (T fact) const
 
vec3_toperator*= (T fact)
 

Public Attributes

x
 
y
 
z
 

Related Functions

(Note that these are not member functions.)

template<typename T >
dotprod (const vec3_t< T > &v1, const vec3_t< T > &v2)
 
template<typename T >
vec3_t< T > crossprod (const vec3_t< T > &a, const vec3_t< T > &b)
 
template<typename T >
std::ostream & operator<< (std::ostream &os, const vec3_t< T > &v)
 

Detailed Description

template<typename T>
class vec3_t< T >

Class representing a 3D cartesian vector.

Definition at line 43 of file vec3.h.

Constructor & Destructor Documentation

◆ vec3_t() [1/2]

template<typename T>
vec3_t< T >::vec3_t ( )
inline

Default constructor. Does not initialize x, y, and z.

Definition at line 51 of file vec3.h.

◆ vec3_t() [2/2]

template<typename T>
vec3_t< T >::vec3_t ( xc,
yc,
zc 
)
inline

Creates a vector with the coordinates xc, yc, and zc.

Definition at line 53 of file vec3.h.

Member Function Documentation

◆ Set()

template<typename T>
void vec3_t< T >::Set ( xc,
yc,
zc 
)
inline

Sets the vector components to xc, yc, and zc.

Definition at line 59 of file vec3.h.

◆ set_z_phi()

template<typename T>
void vec3_t< T >::set_z_phi ( z_,
phi 
)
inline

Creates a unit vector from a z coordinate and an azimuthal angle.

Definition at line 62 of file vec3.h.

◆ Normalize()

template<typename T>
void vec3_t< T >::Normalize ( )
inline

Normalizes the vector to length 1.

Definition at line 72 of file vec3.h.

◆ Length()

template<typename T>
T vec3_t< T >::Length ( ) const
inline

Returns the length of the vector.

Definition at line 87 of file vec3.h.

◆ SquaredLength()

template<typename T>
T vec3_t< T >::SquaredLength ( ) const
inline

Returns the squared length of the vector.

Definition at line 91 of file vec3.h.

◆ operator-() [1/2]

template<typename T>
const vec3_t vec3_t< T >::operator- ( ) const
inline

Returns the vector with the signs of all coordinates flipped.

Definition at line 94 of file vec3.h.

◆ Flip()

template<typename T>
void vec3_t< T >::Flip ( )
inline

Flips the signs of all coordinates.

Definition at line 97 of file vec3.h.

◆ operator+()

template<typename T>
const vec3_t vec3_t< T >::operator+ ( const vec3_t< T > &  vec) const
inline

Returns (*this + vec).

Definition at line 100 of file vec3.h.

◆ operator+=()

template<typename T>
vec3_t& vec3_t< T >::operator+= ( const vec3_t< T > &  vec)
inline

Adds vec to *this.

Definition at line 103 of file vec3.h.

◆ operator-() [2/2]

template<typename T>
const vec3_t vec3_t< T >::operator- ( const vec3_t< T > &  vec) const
inline

Returns (*this - vec).

Definition at line 106 of file vec3.h.

◆ operator-=()

template<typename T>
vec3_t& vec3_t< T >::operator-= ( const vec3_t< T > &  vec)
inline

Subtracts vec from *this.

Definition at line 109 of file vec3.h.

◆ operator*()

template<typename T>
const vec3_t vec3_t< T >::operator* ( fact) const
inline

Returns the vector scaled by fact.

Definition at line 112 of file vec3.h.

◆ operator/()

template<typename T>
const vec3_t vec3_t< T >::operator/ ( fact) const
inline

Returns the vector scaled by 1/fact.

Definition at line 115 of file vec3.h.

◆ operator*=()

template<typename T>
vec3_t& vec3_t< T >::operator*= ( fact)
inline

Scales the vector by fact.

Definition at line 118 of file vec3.h.

Member Data Documentation

◆ x

template<typename T>
T vec3_t< T >::x

x-coordinate

Definition at line 46 of file vec3.h.

◆ y

template<typename T>
T vec3_t< T >::y

y-coordinate

Definition at line 46 of file vec3.h.

◆ z

template<typename T>
T vec3_t< T >::z

z-coordinate

Definition at line 46 of file vec3.h.


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

Generated on Wed Nov 13 2024 12:18:16 for LevelS C++ support library