5 #ifndef __IRR_IRRKLANG_VEC_3D_H_INCLUDED__
6 #define __IRR_IRRKLANG_VEC_3D_H_INCLUDED__
22 vec3d(T nx, T ny, T nz) :
X(nx),
Y(ny),
Z(nz) {};
26 #ifdef __IRR_POINT_3D_H_INCLUDED__
28 vec3d(
const B& other) :
X(other.
X),
Y(other.
Y),
Z(other.
Z) {};
29 #endif // __IRR_POINT_3D_H_INCLUDED__
53 bool operator<=(const vec3d<T>&other)
const {
return X<=other.X &&
Y<=other.Y &&
Z<=other.Z;};
69 void set(
const T nx,
const T ny,
const T nz) {
X=nx;
Y=ny;
Z=nz; }
83 return X*other.
X +
Y*other.
Y +
Z*other.
Z;
91 return sqrt(vx*vx + vy*vy + vz*vz);
99 return (vx*vx + vy*vy + vz*vz);
153 T cs = (T)cos(degrees);
154 T sn = (T)sin(degrees);
169 T cs = (T)cos(degrees);
170 T sn = (T)sin(degrees);
185 T cs = (T)cos(degrees);
186 T sn = (T)sin(degrees);
213 angle.
Y = (T)atan2(
X,
Z);
216 if (angle.
Y < 0.0f) angle.
Y += 360.0f;
217 if (angle.
Y >= 360.0f) angle.
Y -= 360.0f;
221 angle.
X = (T)atan2(z1,
Y);
225 if (angle.
X < 0.0f) angle.
X += 360.0f;
226 if (angle.
X >= 360) angle.
X -= 360.0f;
vec3d< T > operator+(const vec3d< T > &other) const
a 3d vector template class for representing vectors and points in 3d
vec3d< T > getHorizontalAngle()
Gets the Y and Z rotations of a vector.
T dotProduct(const vec3d< T > &other) const
Returns the dot product with another vector.
vec3d< T > operator/(const vec3d< T > &other) const
bool operator==(const vec3d< T > &other) const
vec3d< T > & operator*=(const vec3d< T > &other)
void invert()
Inverts the vector.
vec3d< T > operator/(const T v) const
bool operator!=(const vec3d< T > &other) const
double ik_f64
64 bit floating point variable.
void rotateYZBy(ik_f64 degrees, const vec3d< T > ¢er)
ik_f64 getLength() const
Returns length of the vector.
Everything in the irrKlang Sound Engine can be found in this namespace.
bool equals(const vec3d< T > &other)
returns if this vector equalsfloat the other one, taking floating point rounding errors into account ...
vec3d< T > & operator-=(const vec3d< T > &other)
vec3d< ik_f32 > vec3df
Typedef for a ik_f32 3d vector, a vector using floats for X, Y and Z.
bool isBetweenPoints(const vec3d< T > &begin, const vec3d< T > &end) const
Returns if this vector interpreted as a point is on a line between two other points.
vec3d< T > & operator*=(const T v)
bool operator>=(const vec3d< T > &other) const
vec3d< T > crossProduct(const vec3d< T > &p) const
Calculates the cross product with another vector.
const ik_f64 IK_DEGTORAD64
void rotateXZBy(ik_f64 degrees, const vec3d< T > ¢er)
vec3d< T > getInterpolated(const vec3d< T > &other, ik_f32 d) const
Returns interpolated vector.
vec3d< T > operator*(const T v) const
void set(const T nx, const T ny, const T nz)
bool equalsfloat(const ik_f32 a, const ik_f32 b, const ik_f32 tolerance=IK_ROUNDING_ERROR_32)
ik_f32 getDistanceFromSQ(const vec3d< T > &other) const
Returns squared distance from an other point.
ik_f64 getDistanceFrom(const vec3d< T > &other) const
Returns distance from an other point.
vec3d< T > operator-(const vec3d< T > &other) const
float ik_f32
32 bit floating point variable.
vec3d< T > operator*(const vec3d< T > &other) const
void setLength(T newlength)
Sets the lenght of the vector to a new value.
vec3d< T > & normalize()
Normalizes the vector.
vec3d< T > & operator/=(const vec3d< T > &other)
void rotateXYBy(ik_f64 degrees, const vec3d< T > ¢er)
vec3d< T > & operator/=(const T v)
vec3d< T > operator*(const S scalar, const vec3d< T > &vector)
vec3d< ik_s32 > vec3di
Typedef for an integer 3d vector, a vector using ints for X, Y and Z.
vec3d< T > operator-() const
constructor creating an irrklang vec3d from an irrlicht vector.
void getAs4Values(T *array)
Fills an array of 4 values with the vector data (usually floats).
vec3d< T > & operator+=(const vec3d< T > &other)
ik_f64 getLengthSQ() const
Returns squared length of the vector.
vec3d(const vec3d< T > &other)
vec3d< T > & operator=(const vec3d< T > &other)
void set(const vec3d< T > &p)