45 #ifndef _VRENDER_NVECTOR3_H 46 #define _VRENDER_NVECTOR3_H 60 inline NVector3(
double x,
double y,
double z,
bool normalization=
true)
62 setXYZ(x,y,z,normalization);
67 inline double x()
const {
return _n[0];}
68 inline double y()
const {
return _n[1];}
69 inline double z()
const {
return _n[2];}
70 void setXYZ(
double x,
double y,
double z,
bool normalization=
true);
99 inline double norm()
const {
return 1.0;}
106 throw std::runtime_error(
"Out of bounds in NVector3::operator[]") ;
120 #endif // _NVECTOR3_H NVector3(double x, double y, double z, bool normalization=true)
void setXYZ(double x, double y, double z, bool normalization=true)
Writing X,Y and Z coordinates.
double operator[](int i) const
friend NVector3 operator-(const NVector3 &u)
NVector3()
Default constructor (the default normalized vector is (1,0,0))
NVector3 & operator=(const NVector3 &u)
Assignment.
friend std::ostream & operator<<(std::ostream &out, const NVector3 &u)
Out stream override: prints the 3 normalized vector components.
friend double operator*(const NVector3 &u, const Vector3 &v)
double squareNorm() const
double _n[3]
normalized vector