hand-optimize linmath, force inlining
This commit is contained in:
parent
f3bda05a25
commit
23c5d85166
|
|
@ -3,47 +3,47 @@
|
|||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
INLINE LVecBase2d cast_to_double(const LVecBase2f &source) {
|
||||
INLINE_LINMATH LVecBase2d cast_to_double(const LVecBase2f &source) {
|
||||
return LCAST(double, source);
|
||||
}
|
||||
|
||||
INLINE LVecBase3d cast_to_double(const LVecBase3f &source) {
|
||||
INLINE_LINMATH LVecBase3d cast_to_double(const LVecBase3f &source) {
|
||||
return LCAST(double, source);
|
||||
}
|
||||
|
||||
INLINE LVecBase4d cast_to_double(const LVecBase4f &source) {
|
||||
INLINE_LINMATH LVecBase4d cast_to_double(const LVecBase4f &source) {
|
||||
return LCAST(double, source);
|
||||
}
|
||||
|
||||
INLINE LVector2d cast_to_double(const LVector2f &source) {
|
||||
INLINE_LINMATH LVector2d cast_to_double(const LVector2f &source) {
|
||||
return LCAST(double, source);
|
||||
}
|
||||
|
||||
INLINE LVector3d cast_to_double(const LVector3f &source) {
|
||||
INLINE_LINMATH LVector3d cast_to_double(const LVector3f &source) {
|
||||
return LCAST(double, source);
|
||||
}
|
||||
|
||||
INLINE LVector4d cast_to_double(const LVector4f &source) {
|
||||
INLINE_LINMATH LVector4d cast_to_double(const LVector4f &source) {
|
||||
return LCAST(double, source);
|
||||
}
|
||||
|
||||
INLINE LPoint2d cast_to_double(const LPoint2f &source) {
|
||||
INLINE_LINMATH LPoint2d cast_to_double(const LPoint2f &source) {
|
||||
return LCAST(double, source);
|
||||
}
|
||||
|
||||
INLINE LPoint3d cast_to_double(const LPoint3f &source) {
|
||||
INLINE_LINMATH LPoint3d cast_to_double(const LPoint3f &source) {
|
||||
return LCAST(double, source);
|
||||
}
|
||||
|
||||
INLINE LPoint4d cast_to_double(const LPoint4f &source) {
|
||||
INLINE_LINMATH LPoint4d cast_to_double(const LPoint4f &source) {
|
||||
return LCAST(double, source);
|
||||
}
|
||||
|
||||
INLINE LMatrix3d cast_to_double(const LMatrix3f &source) {
|
||||
INLINE_LINMATH LMatrix3d cast_to_double(const LMatrix3f &source) {
|
||||
return LCAST(double, source);
|
||||
}
|
||||
|
||||
INLINE LMatrix4d cast_to_double(const LMatrix4f &source) {
|
||||
INLINE_LINMATH LMatrix4d cast_to_double(const LMatrix4f &source) {
|
||||
return LCAST(double, source);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,17 +13,17 @@
|
|||
// These are a number of functions that convert our various math
|
||||
// objects between floats and doubles.
|
||||
|
||||
INLINE LVecBase2d cast_to_double(const LVecBase2f &source);
|
||||
INLINE LVecBase3d cast_to_double(const LVecBase3f &source);
|
||||
INLINE LVecBase4d cast_to_double(const LVecBase4f &source);
|
||||
INLINE LVector2d cast_to_double(const LVector2f &source);
|
||||
INLINE LVector3d cast_to_double(const LVector3f &source);
|
||||
INLINE LVector4d cast_to_double(const LVector4f &source);
|
||||
INLINE LPoint2d cast_to_double(const LPoint2f &source);
|
||||
INLINE LPoint3d cast_to_double(const LPoint3f &source);
|
||||
INLINE LPoint4d cast_to_double(const LPoint4f &source);
|
||||
INLINE LMatrix3d cast_to_double(const LMatrix3f &source);
|
||||
INLINE LMatrix4d cast_to_double(const LMatrix4f &source);
|
||||
INLINE_LINMATH LVecBase2d cast_to_double(const LVecBase2f &source);
|
||||
INLINE_LINMATH LVecBase3d cast_to_double(const LVecBase3f &source);
|
||||
INLINE_LINMATH LVecBase4d cast_to_double(const LVecBase4f &source);
|
||||
INLINE_LINMATH LVector2d cast_to_double(const LVector2f &source);
|
||||
INLINE_LINMATH LVector3d cast_to_double(const LVector3f &source);
|
||||
INLINE_LINMATH LVector4d cast_to_double(const LVector4f &source);
|
||||
INLINE_LINMATH LPoint2d cast_to_double(const LPoint2f &source);
|
||||
INLINE_LINMATH LPoint3d cast_to_double(const LPoint3f &source);
|
||||
INLINE_LINMATH LPoint4d cast_to_double(const LPoint4f &source);
|
||||
INLINE_LINMATH LMatrix3d cast_to_double(const LMatrix3f &source);
|
||||
INLINE_LINMATH LMatrix4d cast_to_double(const LMatrix4f &source);
|
||||
|
||||
#include "cast_to_double.I"
|
||||
|
||||
|
|
|
|||
|
|
@ -3,47 +3,47 @@
|
|||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
INLINE LVecBase2f cast_to_float(const LVecBase2d &source) {
|
||||
INLINE_LINMATH LVecBase2f cast_to_float(const LVecBase2d &source) {
|
||||
return LCAST(float, source);
|
||||
}
|
||||
|
||||
INLINE LVecBase3f cast_to_float(const LVecBase3d &source) {
|
||||
INLINE_LINMATH LVecBase3f cast_to_float(const LVecBase3d &source) {
|
||||
return LCAST(float, source);
|
||||
}
|
||||
|
||||
INLINE LVecBase4f cast_to_float(const LVecBase4d &source) {
|
||||
INLINE_LINMATH LVecBase4f cast_to_float(const LVecBase4d &source) {
|
||||
return LCAST(float, source);
|
||||
}
|
||||
|
||||
INLINE LVector2f cast_to_float(const LVector2d &source) {
|
||||
INLINE_LINMATH LVector2f cast_to_float(const LVector2d &source) {
|
||||
return LCAST(float, source);
|
||||
}
|
||||
|
||||
INLINE LVector3f cast_to_float(const LVector3d &source) {
|
||||
INLINE_LINMATH LVector3f cast_to_float(const LVector3d &source) {
|
||||
return LCAST(float, source);
|
||||
}
|
||||
|
||||
INLINE LVector4f cast_to_float(const LVector4d &source) {
|
||||
INLINE_LINMATH LVector4f cast_to_float(const LVector4d &source) {
|
||||
return LCAST(float, source);
|
||||
}
|
||||
|
||||
INLINE LPoint2f cast_to_float(const LPoint2d &source) {
|
||||
INLINE_LINMATH LPoint2f cast_to_float(const LPoint2d &source) {
|
||||
return LCAST(float, source);
|
||||
}
|
||||
|
||||
INLINE LPoint3f cast_to_float(const LPoint3d &source) {
|
||||
INLINE_LINMATH LPoint3f cast_to_float(const LPoint3d &source) {
|
||||
return LCAST(float, source);
|
||||
}
|
||||
|
||||
INLINE LPoint4f cast_to_float(const LPoint4d &source) {
|
||||
INLINE_LINMATH LPoint4f cast_to_float(const LPoint4d &source) {
|
||||
return LCAST(float, source);
|
||||
}
|
||||
|
||||
INLINE LMatrix3f cast_to_float(const LMatrix3d &source) {
|
||||
INLINE_LINMATH LMatrix3f cast_to_float(const LMatrix3d &source) {
|
||||
return LCAST(float, source);
|
||||
}
|
||||
|
||||
INLINE LMatrix4f cast_to_float(const LMatrix4d &source) {
|
||||
INLINE_LINMATH LMatrix4f cast_to_float(const LMatrix4d &source) {
|
||||
return LCAST(float, source);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,17 +13,17 @@
|
|||
// These are a number of functions that convert our various math
|
||||
// objects between floats and doubles.
|
||||
|
||||
INLINE LVecBase2f cast_to_float(const LVecBase2d &source);
|
||||
INLINE LVecBase3f cast_to_float(const LVecBase3d &source);
|
||||
INLINE LVecBase4f cast_to_float(const LVecBase4d &source);
|
||||
INLINE LVector2f cast_to_float(const LVector2d &source);
|
||||
INLINE LVector3f cast_to_float(const LVector3d &source);
|
||||
INLINE LVector4f cast_to_float(const LVector4d &source);
|
||||
INLINE LPoint2f cast_to_float(const LPoint2d &source);
|
||||
INLINE LPoint3f cast_to_float(const LPoint3d &source);
|
||||
INLINE LPoint4f cast_to_float(const LPoint4d &source);
|
||||
INLINE LMatrix3f cast_to_float(const LMatrix3d &source);
|
||||
INLINE LMatrix4f cast_to_float(const LMatrix4d &source);
|
||||
INLINE_LINMATH LVecBase2f cast_to_float(const LVecBase2d &source);
|
||||
INLINE_LINMATH LVecBase3f cast_to_float(const LVecBase3d &source);
|
||||
INLINE_LINMATH LVecBase4f cast_to_float(const LVecBase4d &source);
|
||||
INLINE_LINMATH LVector2f cast_to_float(const LVector2d &source);
|
||||
INLINE_LINMATH LVector3f cast_to_float(const LVector3d &source);
|
||||
INLINE_LINMATH LVector4f cast_to_float(const LVector4d &source);
|
||||
INLINE_LINMATH LPoint2f cast_to_float(const LPoint2d &source);
|
||||
INLINE_LINMATH LPoint3f cast_to_float(const LPoint3d &source);
|
||||
INLINE_LINMATH LPoint4f cast_to_float(const LPoint4d &source);
|
||||
INLINE_LINMATH LMatrix3f cast_to_float(const LMatrix3d &source);
|
||||
INLINE_LINMATH LMatrix4f cast_to_float(const LMatrix4d &source);
|
||||
|
||||
#include "cast_to_float.I"
|
||||
|
||||
|
|
|
|||
|
|
@ -9,19 +9,19 @@
|
|||
#include <float.h>
|
||||
#endif
|
||||
|
||||
INLINE float csqrt(float v) {
|
||||
INLINE_LINMATH float csqrt(float v) {
|
||||
return sqrtf(v);
|
||||
}
|
||||
|
||||
INLINE float csin(float v) {
|
||||
INLINE_LINMATH float csin(float v) {
|
||||
return sinf(v);
|
||||
}
|
||||
|
||||
INLINE float ccos(float v) {
|
||||
INLINE_LINMATH float ccos(float v) {
|
||||
return cosf(v);
|
||||
}
|
||||
|
||||
INLINE void
|
||||
INLINE_LINMATH void
|
||||
sincosf(float v, float *pSinResult, float *pCosResult) {
|
||||
|
||||
// MS VC defines _M_IX86 for x86. gcc should define _X86_
|
||||
|
|
@ -41,8 +41,8 @@ sincosf(float v, float *pSinResult, float *pCosResult) {
|
|||
#endif //!_X86_
|
||||
}
|
||||
|
||||
INLINE void
|
||||
sincos(double v, double *pSinResult, double *pCosResult) {
|
||||
INLINE_LINMATH void
|
||||
sincosd(double v, double *pSinResult, double *pCosResult) {
|
||||
#if defined(_M_IX86) || defined(_X86_)
|
||||
//#define fsincos_opcode __asm _emit 0xd9 __asm _emit 0xfb
|
||||
__asm {
|
||||
|
|
@ -59,43 +59,43 @@ sincos(double v, double *pSinResult, double *pCosResult) {
|
|||
#endif //!_X86_
|
||||
}
|
||||
|
||||
INLINE void csincos(float v,float *pSinResult, float *pCosResult) {
|
||||
INLINE_LINMATH void csincos(float v,float *pSinResult, float *pCosResult) {
|
||||
sincosf(v,pSinResult,pCosResult);
|
||||
}
|
||||
|
||||
INLINE void csincos(double v,double *pSinResult, double *pCosResult) {
|
||||
sincos(v,pSinResult,pCosResult);
|
||||
INLINE_LINMATH void csincos(double v,double *pSinResult, double *pCosResult) {
|
||||
sincosd(v,pSinResult,pCosResult);
|
||||
}
|
||||
|
||||
INLINE float cabs(float v) {
|
||||
INLINE_LINMATH float cabs(float v) {
|
||||
return fabs(v);
|
||||
}
|
||||
|
||||
INLINE float catan2(float y, float x) {
|
||||
INLINE_LINMATH float catan2(float y, float x) {
|
||||
return atan2f(y, x);
|
||||
}
|
||||
|
||||
INLINE double csqrt(double v) {
|
||||
INLINE_LINMATH double csqrt(double v) {
|
||||
return sqrt(v);
|
||||
}
|
||||
|
||||
INLINE double csin(double v) {
|
||||
INLINE_LINMATH double csin(double v) {
|
||||
return sin(v);
|
||||
}
|
||||
|
||||
INLINE double ccos(double v) {
|
||||
INLINE_LINMATH double ccos(double v) {
|
||||
return cos(v);
|
||||
}
|
||||
|
||||
INLINE double cabs(double v) {
|
||||
INLINE_LINMATH double cabs(double v) {
|
||||
return fabs(v);
|
||||
}
|
||||
|
||||
INLINE double catan2(double y, double x) {
|
||||
INLINE_LINMATH double catan2(double y, double x) {
|
||||
return atan2(y, x);
|
||||
}
|
||||
|
||||
INLINE bool cnan(double v) {
|
||||
INLINE_LINMATH bool cnan(double v) {
|
||||
#ifndef _WIN32
|
||||
return (isnan(v) != 0);
|
||||
#else
|
||||
|
|
|
|||
|
|
@ -16,23 +16,23 @@
|
|||
// explicitly whether we need to call, for instance, sqrtf() or
|
||||
// sqrt().
|
||||
|
||||
INLINE float csqrt(float v);
|
||||
INLINE float csin(float v);
|
||||
INLINE float ccos(float v);
|
||||
INLINE void csincos(float v, float *pSinResult, float *pCosResult); // does both at once (faster on x86)
|
||||
INLINE float cabs(float v);
|
||||
INLINE float catan2(float y, float x);
|
||||
INLINE_LINMATH float csqrt(float v);
|
||||
INLINE_LINMATH float csin(float v);
|
||||
INLINE_LINMATH float ccos(float v);
|
||||
INLINE_LINMATH void csincos(float v, float *pSinResult, float *pCosResult); // does both at once (faster on x86)
|
||||
INLINE_LINMATH float cabs(float v);
|
||||
INLINE_LINMATH float catan2(float y, float x);
|
||||
|
||||
INLINE double csqrt(double v);
|
||||
INLINE double csin(double v);
|
||||
INLINE double ccos(double v);
|
||||
INLINE double cabs(double v);
|
||||
INLINE double catan2(double y, double x);
|
||||
INLINE void csincos(double v, double *pSinResult, double *pCosResult); // does both at once (faster on x86)
|
||||
INLINE_LINMATH double csqrt(double v);
|
||||
INLINE_LINMATH double csin(double v);
|
||||
INLINE_LINMATH double ccos(double v);
|
||||
INLINE_LINMATH double cabs(double v);
|
||||
INLINE_LINMATH double catan2(double y, double x);
|
||||
INLINE_LINMATH void csincos(double v, double *pSinResult, double *pCosResult); // does both at once (faster on x86)
|
||||
|
||||
// Returns true if the number is nan, false if it's a genuine number
|
||||
// or infinity.
|
||||
INLINE bool cnan(double v);
|
||||
INLINE_LINMATH bool cnan(double v);
|
||||
|
||||
#include "cmath.I"
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
// Description: Computes the 4x4 matrix according to scale, rotation,
|
||||
// and translation.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void
|
||||
INLINE_LINMATH void
|
||||
compose_matrix(FLOATNAME(LMatrix4) &mat,
|
||||
const FLOATNAME(LVecBase3) &scale,
|
||||
const FLOATNAME(LVecBase3) &hpr,
|
||||
|
|
@ -21,7 +21,7 @@ compose_matrix(FLOATNAME(LMatrix4) &mat,
|
|||
mat = FLOATNAME(LMatrix4)(upper3, translate);
|
||||
}
|
||||
|
||||
INLINE void
|
||||
INLINE_LINMATH void
|
||||
compose_matrix(FLOATNAME(LMatrix4) &mat,
|
||||
const FLOATTYPE components[9],
|
||||
CoordinateSystem cs) {
|
||||
|
|
@ -46,7 +46,7 @@ compose_matrix(FLOATNAME(LMatrix4) &mat,
|
|||
// also a shear component or if the matrix is not
|
||||
// affine.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE bool
|
||||
INLINE_LINMATH bool
|
||||
decompose_matrix(const FLOATNAME(LMatrix4) &mat,
|
||||
FLOATNAME(LVecBase3) &scale,
|
||||
FLOATNAME(LVecBase3) &hpr,
|
||||
|
|
@ -71,7 +71,7 @@ decompose_matrix(const FLOATNAME(LMatrix4) &mat,
|
|||
// by examining the matrix; this helps alleviate roll
|
||||
// instability due to roundoff errors or gimbal lock.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE bool
|
||||
INLINE_LINMATH bool
|
||||
decompose_matrix(const FLOATNAME(LMatrix4) &mat,
|
||||
FLOATNAME(LVecBase3) &scale,
|
||||
FLOATNAME(LVecBase3) &hpr,
|
||||
|
|
@ -83,7 +83,7 @@ decompose_matrix(const FLOATNAME(LMatrix4) &mat,
|
|||
return decompose_matrix(mat.get_upper_3(), scale, hpr, roll, cs);
|
||||
}
|
||||
|
||||
INLINE bool
|
||||
INLINE_LINMATH bool
|
||||
decompose_matrix(const FLOATNAME(LMatrix4) &mat,
|
||||
FLOATTYPE components[9],
|
||||
CoordinateSystem cs) {
|
||||
|
|
|
|||
|
|
@ -12,14 +12,14 @@ compose_matrix(FLOATNAME(LMatrix3) &mat,
|
|||
const FLOATNAME(LVecBase3) &hpr,
|
||||
CoordinateSystem cs = CS_default);
|
||||
|
||||
INLINE void
|
||||
INLINE_LINMATH void
|
||||
compose_matrix(FLOATNAME(LMatrix4) &mat,
|
||||
const FLOATNAME(LVecBase3) &scale,
|
||||
const FLOATNAME(LVecBase3) &hpr,
|
||||
const FLOATNAME(LVecBase3) &translate,
|
||||
CoordinateSystem cs = CS_default);
|
||||
|
||||
INLINE void
|
||||
INLINE_LINMATH void
|
||||
compose_matrix(FLOATNAME(LMatrix4) &mat, const FLOATTYPE components[9],
|
||||
CoordinateSystem cs = CS_default);
|
||||
|
||||
|
|
@ -36,14 +36,14 @@ decompose_matrix(const FLOATNAME(LMatrix3) &mat,
|
|||
FLOATTYPE roll,
|
||||
CoordinateSystem cs = CS_default);
|
||||
|
||||
INLINE bool
|
||||
INLINE_LINMATH bool
|
||||
decompose_matrix(const FLOATNAME(LMatrix4) &mat,
|
||||
FLOATNAME(LVecBase3) &scale,
|
||||
FLOATNAME(LVecBase3) &hpr,
|
||||
FLOATNAME(LVecBase3) &translate,
|
||||
CoordinateSystem cs = CS_default);
|
||||
|
||||
INLINE bool
|
||||
INLINE_LINMATH bool
|
||||
decompose_matrix(const FLOATNAME(LMatrix4) &mat,
|
||||
FLOATNAME(LVecBase3) &scale,
|
||||
FLOATNAME(LVecBase3) &hpr,
|
||||
|
|
@ -51,7 +51,7 @@ decompose_matrix(const FLOATNAME(LMatrix4) &mat,
|
|||
FLOATTYPE roll,
|
||||
CoordinateSystem cs = CS_default);
|
||||
|
||||
INLINE bool
|
||||
INLINE_LINMATH bool
|
||||
decompose_matrix(const FLOATNAME(LMatrix4) &mat, FLOATTYPE components[9],
|
||||
CoordinateSystem CS = CS_default);
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@
|
|||
|
||||
CoordinateSystem default_coordinate_system;
|
||||
|
||||
|
||||
CoordinateSystem
|
||||
parse_coordinate_system_string(const string &str) {
|
||||
// First, make sure the string is lowercase before we compare it, so
|
||||
|
|
@ -45,7 +44,7 @@ parse_coordinate_system_string(const string &str) {
|
|||
return CS_invalid;
|
||||
}
|
||||
|
||||
bool
|
||||
INLINE_LINMATH bool
|
||||
is_right_handed(CoordinateSystem cs) {
|
||||
if (cs == CS_default) {
|
||||
cs = default_coordinate_system;
|
||||
|
|
|
|||
|
|
@ -39,6 +39,8 @@ extern CoordinateSystem EXPCL_PANDA default_coordinate_system;
|
|||
CoordinateSystem EXPCL_PANDA parse_coordinate_system_string(const string &str);
|
||||
bool EXPCL_PANDA is_right_handed(CoordinateSystem cs = CS_default);
|
||||
|
||||
#define IS_LEFT_HANDED_COORDSYSTEM(cs) ((cs==CS_zup_left) || (cs==CS_yup_left))
|
||||
|
||||
ostream EXPCL_PANDA &operator << (ostream &out, CoordinateSystem cs);
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -11,8 +11,8 @@
|
|||
#include "mathNumbers.h"
|
||||
|
||||
BEGIN_PUBLISH
|
||||
INLINE double deg_2_rad( double f ) { return f * MathNumbers::pi / 180.0; }
|
||||
INLINE double rad_2_deg( double f ) { return f * 180.0 / MathNumbers::pi; }
|
||||
INLINE_LINMATH double deg_2_rad( double f ) { return f * MathNumbers::pi / 180.0; }
|
||||
INLINE_LINMATH double rad_2_deg( double f ) { return f * 180.0 / MathNumbers::pi; }
|
||||
END_PUBLISH
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,55 +1,55 @@
|
|||
|
||||
INLINE FLOATNAME2(LVecBase2)
|
||||
INLINE_LINMATH FLOATNAME2(LVecBase2)
|
||||
lcast_to(FLOATTYPE2 *, const FLOATNAME(LVecBase2) &source) {
|
||||
return FLOATNAME2(LVecBase2)(source[0], source[1]);
|
||||
}
|
||||
|
||||
INLINE FLOATNAME2(LVecBase3)
|
||||
INLINE_LINMATH FLOATNAME2(LVecBase3)
|
||||
lcast_to(FLOATTYPE2 *, const FLOATNAME(LVecBase3) &source) {
|
||||
return FLOATNAME2(LVecBase3)(source[0], source[1], source[2]);
|
||||
}
|
||||
|
||||
INLINE FLOATNAME2(LVecBase4)
|
||||
INLINE_LINMATH FLOATNAME2(LVecBase4)
|
||||
lcast_to(FLOATTYPE2 *, const FLOATNAME(LVecBase4) &source) {
|
||||
return FLOATNAME2(LVecBase4)(source[0], source[1], source[2], source[3]);
|
||||
}
|
||||
|
||||
INLINE FLOATNAME2(LVector2)
|
||||
INLINE_LINMATH FLOATNAME2(LVector2)
|
||||
lcast_to(FLOATTYPE2 *, const FLOATNAME(LVector2) &source) {
|
||||
return FLOATNAME2(LVector2)(source[0], source[1]);
|
||||
}
|
||||
|
||||
INLINE FLOATNAME2(LVector3)
|
||||
INLINE_LINMATH FLOATNAME2(LVector3)
|
||||
lcast_to(FLOATTYPE2 *, const FLOATNAME(LVector3) &source) {
|
||||
return FLOATNAME2(LVector3)(source[0], source[1], source[2]);
|
||||
}
|
||||
|
||||
INLINE FLOATNAME2(LVector4)
|
||||
INLINE_LINMATH FLOATNAME2(LVector4)
|
||||
lcast_to(FLOATTYPE2 *, const FLOATNAME(LVector4) &source) {
|
||||
return FLOATNAME2(LVector4)(source[0], source[1], source[2], source[3]);
|
||||
}
|
||||
|
||||
INLINE FLOATNAME2(LPoint2)
|
||||
INLINE_LINMATH FLOATNAME2(LPoint2)
|
||||
lcast_to(FLOATTYPE2 *, const FLOATNAME(LPoint2) &source) {
|
||||
return FLOATNAME2(LPoint2)(source[0], source[1]);
|
||||
}
|
||||
|
||||
INLINE FLOATNAME2(LPoint3)
|
||||
INLINE_LINMATH FLOATNAME2(LPoint3)
|
||||
lcast_to(FLOATTYPE2 *, const FLOATNAME(LPoint3) &source) {
|
||||
return FLOATNAME2(LPoint3)(source[0], source[1], source[2]);
|
||||
}
|
||||
|
||||
INLINE FLOATNAME2(LPoint4)
|
||||
INLINE_LINMATH FLOATNAME2(LPoint4)
|
||||
lcast_to(FLOATTYPE2 *, const FLOATNAME(LPoint4) &source) {
|
||||
return FLOATNAME2(LPoint4)(source[0], source[1], source[2], source[3]);
|
||||
}
|
||||
|
||||
INLINE FLOATNAME2(LQuaternion)
|
||||
INLINE_LINMATH FLOATNAME2(LQuaternion)
|
||||
lcast_to(FLOATTYPE2 *, const FLOATNAME(LQuaternion)& c) {
|
||||
return FLOATNAME2(LQuaternion)(c.get_r(), c.get_i(), c.get_j(), c.get_k());
|
||||
}
|
||||
|
||||
INLINE FLOATNAME2(LMatrix3)
|
||||
INLINE_LINMATH FLOATNAME2(LMatrix3)
|
||||
lcast_to(FLOATTYPE2 *, const FLOATNAME(LMatrix3) &source) {
|
||||
return FLOATNAME2(LMatrix3)
|
||||
(source(0, 0), source(0, 1), source(0, 2),
|
||||
|
|
@ -57,7 +57,7 @@ lcast_to(FLOATTYPE2 *, const FLOATNAME(LMatrix3) &source) {
|
|||
source(2, 0), source(2, 1), source(2, 2));
|
||||
}
|
||||
|
||||
INLINE FLOATNAME2(LMatrix4)
|
||||
INLINE_LINMATH FLOATNAME2(LMatrix4)
|
||||
lcast_to(FLOATTYPE2 *, const FLOATNAME(LMatrix4) &source) {
|
||||
return FLOATNAME2(LMatrix4)
|
||||
(source(0, 0), source(0, 1), source(0, 2), source(0, 3),
|
||||
|
|
|
|||
|
|
@ -3,40 +3,40 @@
|
|||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
INLINE FLOATNAME2(LVecBase2)
|
||||
INLINE_LINMATH FLOATNAME2(LVecBase2)
|
||||
lcast_to(FLOATTYPE2 *, const FLOATNAME(LVecBase2) &source);
|
||||
|
||||
INLINE FLOATNAME2(LVecBase3)
|
||||
INLINE_LINMATH FLOATNAME2(LVecBase3)
|
||||
lcast_to(FLOATTYPE2 *, const FLOATNAME(LVecBase3) &source);
|
||||
|
||||
INLINE FLOATNAME2(LVecBase4)
|
||||
INLINE_LINMATH FLOATNAME2(LVecBase4)
|
||||
lcast_to(FLOATTYPE2 *, const FLOATNAME(LVecBase4) &source);
|
||||
|
||||
INLINE FLOATNAME2(LVector2)
|
||||
INLINE_LINMATH FLOATNAME2(LVector2)
|
||||
lcast_to(FLOATTYPE2 *, const FLOATNAME(LVector2) &source);
|
||||
|
||||
INLINE FLOATNAME2(LVector3)
|
||||
INLINE_LINMATH FLOATNAME2(LVector3)
|
||||
lcast_to(FLOATTYPE2 *, const FLOATNAME(LVector3) &source);
|
||||
|
||||
INLINE FLOATNAME2(LVector4)
|
||||
INLINE_LINMATH FLOATNAME2(LVector4)
|
||||
lcast_to(FLOATTYPE2 *, const FLOATNAME(LVector4) &source);
|
||||
|
||||
INLINE FLOATNAME2(LPoint2)
|
||||
INLINE_LINMATH FLOATNAME2(LPoint2)
|
||||
lcast_to(FLOATTYPE2 *, const FLOATNAME(LPoint2) &source);
|
||||
|
||||
INLINE FLOATNAME2(LPoint3)
|
||||
INLINE_LINMATH FLOATNAME2(LPoint3)
|
||||
lcast_to(FLOATTYPE2 *, const FLOATNAME(LPoint3) &source);
|
||||
|
||||
INLINE FLOATNAME2(LPoint4)
|
||||
INLINE_LINMATH FLOATNAME2(LPoint4)
|
||||
lcast_to(FLOATTYPE2 *, const FLOATNAME(LPoint4) &source);
|
||||
|
||||
INLINE FLOATNAME2(LQuaternion)
|
||||
INLINE_LINMATH FLOATNAME2(LQuaternion)
|
||||
lcast_to(FLOATTYPE2 *, const FLOATNAME(LQuaternion)& c);
|
||||
|
||||
INLINE FLOATNAME2(LMatrix3)
|
||||
INLINE_LINMATH FLOATNAME2(LMatrix3)
|
||||
lcast_to(FLOATTYPE2 *, const FLOATNAME(LMatrix3) &source);
|
||||
|
||||
INLINE FLOATNAME2(LMatrix4)
|
||||
INLINE_LINMATH FLOATNAME2(LMatrix4)
|
||||
lcast_to(FLOATTYPE2 *, const FLOATNAME(LMatrix4) &source);
|
||||
|
||||
#include "lcast_to_src.I"
|
||||
|
|
|
|||
|
|
@ -9,17 +9,17 @@
|
|||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
INLINE FLOATNAME(LVecBase3)
|
||||
INLINE_LINMATH FLOATNAME(LVecBase3)
|
||||
operator * (const FLOATNAME(LVecBase3) &v, const FLOATNAME(LMatrix3) &m) {
|
||||
return m.xform(v);
|
||||
}
|
||||
|
||||
INLINE FLOATNAME(LVector3)
|
||||
INLINE_LINMATH FLOATNAME(LVector3)
|
||||
operator * (const FLOATNAME(LVector3) &v, const FLOATNAME(LMatrix3) &m) {
|
||||
return m.xform(v);
|
||||
}
|
||||
|
||||
INLINE FLOATNAME(LPoint3)
|
||||
INLINE_LINMATH FLOATNAME(LPoint3)
|
||||
operator * (const FLOATNAME(LPoint3) &v, const FLOATNAME(LMatrix3) &m) {
|
||||
return m.xform(v);
|
||||
}
|
||||
|
|
@ -29,7 +29,7 @@ operator * (const FLOATNAME(LPoint3) &v, const FLOATNAME(LMatrix3) &m) {
|
|||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
INLINE FLOATNAME(LVector2)
|
||||
INLINE_LINMATH FLOATNAME(LVector2)
|
||||
operator * (const FLOATNAME(LVector2) &v, const FLOATNAME(LMatrix3) &m) {
|
||||
return m.xform_vec(v);
|
||||
}
|
||||
|
|
@ -39,7 +39,7 @@ operator * (const FLOATNAME(LVector2) &v, const FLOATNAME(LMatrix3) &m) {
|
|||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
INLINE FLOATNAME(LPoint2)
|
||||
INLINE_LINMATH FLOATNAME(LPoint2)
|
||||
operator * (const FLOATNAME(LPoint2) &v, const FLOATNAME(LMatrix3) &m) {
|
||||
return m.xform_point(v);
|
||||
}
|
||||
|
|
@ -50,17 +50,17 @@ operator * (const FLOATNAME(LPoint2) &v, const FLOATNAME(LMatrix3) &m) {
|
|||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
INLINE FLOATNAME(LVecBase4)
|
||||
INLINE_LINMATH FLOATNAME(LVecBase4)
|
||||
operator * (const FLOATNAME(LVecBase4) &v, const FLOATNAME(LMatrix4) &m) {
|
||||
return m.xform(v);
|
||||
}
|
||||
|
||||
INLINE FLOATNAME(LVector4)
|
||||
INLINE_LINMATH FLOATNAME(LVector4)
|
||||
operator * (const FLOATNAME(LVector4) &v, const FLOATNAME(LMatrix4) &m) {
|
||||
return m.xform(v);
|
||||
}
|
||||
|
||||
INLINE FLOATNAME(LPoint4)
|
||||
INLINE_LINMATH FLOATNAME(LPoint4)
|
||||
operator * (const FLOATNAME(LPoint4) &v, const FLOATNAME(LMatrix4) &m) {
|
||||
return m.xform(v);
|
||||
}
|
||||
|
|
@ -71,7 +71,7 @@ operator * (const FLOATNAME(LPoint4) &v, const FLOATNAME(LMatrix4) &m) {
|
|||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
INLINE FLOATNAME(LVector3)
|
||||
INLINE_LINMATH FLOATNAME(LVector3)
|
||||
operator * (const FLOATNAME(LVector3) &v, const FLOATNAME(LMatrix4) &m) {
|
||||
return m.xform_vec(v);
|
||||
}
|
||||
|
|
@ -81,7 +81,7 @@ operator * (const FLOATNAME(LVector3) &v, const FLOATNAME(LMatrix4) &m) {
|
|||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
INLINE FLOATNAME(LPoint3)
|
||||
INLINE_LINMATH FLOATNAME(LPoint3)
|
||||
operator * (const FLOATNAME(LPoint3) &v, const FLOATNAME(LMatrix4) &m) {
|
||||
return m.xform_point(v);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,25 +7,25 @@ BEGIN_PUBLISH
|
|||
|
||||
// vector times matrix3
|
||||
|
||||
INLINE FLOATNAME(LVecBase3)
|
||||
INLINE_LINMATH FLOATNAME(LVecBase3)
|
||||
operator * (const FLOATNAME(LVecBase3) &v, const FLOATNAME(LMatrix3) &m);
|
||||
|
||||
INLINE FLOATNAME(LVector2)
|
||||
INLINE_LINMATH FLOATNAME(LVector2)
|
||||
operator * (const FLOATNAME(LVector2) &v, const FLOATNAME(LMatrix3) &m);
|
||||
|
||||
INLINE FLOATNAME(LPoint2)
|
||||
INLINE_LINMATH FLOATNAME(LPoint2)
|
||||
operator * (const FLOATNAME(LPoint2) &v, const FLOATNAME(LMatrix3) &m);
|
||||
|
||||
|
||||
// vector times matrix4
|
||||
|
||||
INLINE FLOATNAME(LVecBase4)
|
||||
INLINE_LINMATH FLOATNAME(LVecBase4)
|
||||
operator * (const FLOATNAME(LVecBase4) &v, const FLOATNAME(LMatrix4) &m);
|
||||
|
||||
INLINE FLOATNAME(LVector3)
|
||||
INLINE_LINMATH FLOATNAME(LVector3)
|
||||
operator * (const FLOATNAME(LVector3) &v, const FLOATNAME(LMatrix4) &m);
|
||||
|
||||
INLINE FLOATNAME(LPoint3)
|
||||
INLINE_LINMATH FLOATNAME(LPoint3)
|
||||
operator * (const FLOATNAME(LPoint3) &v, const FLOATNAME(LMatrix4) &m);
|
||||
|
||||
END_PUBLISH
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -36,8 +36,8 @@ fill(FLOATTYPE fill_value) {
|
|||
int FLOATNAME(LMatrix3)::
|
||||
compare_to(const FLOATNAME(LMatrix3) &other, FLOATTYPE threshold) const {
|
||||
for (int i = 0; i < 9; i++) {
|
||||
if (!IS_THRESHOLD_EQUAL(_data[i], other._data[i], threshold)) {
|
||||
return (_data[i] < other._data[i]) ? -1 : 1;
|
||||
if (!IS_THRESHOLD_EQUAL(_m.data[i], other._m.data[i], threshold)) {
|
||||
return (_m.data[i] < other._m.data[i]) ? -1 : 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -16,87 +16,87 @@ PUBLISHED:
|
|||
typedef const FLOATTYPE *iterator;
|
||||
typedef const FLOATTYPE *const_iterator;
|
||||
|
||||
INLINE FLOATNAME(LMatrix3)();
|
||||
INLINE FLOATNAME(LMatrix3)(const FLOATNAME(LMatrix3) &other);
|
||||
INLINE FLOATNAME(LMatrix3) &operator = (const FLOATNAME(LMatrix3) &other);
|
||||
INLINE FLOATNAME(LMatrix3) &operator = (FLOATTYPE fill_value);
|
||||
INLINE FLOATNAME(LMatrix3)(FLOATTYPE e00, FLOATTYPE e01, FLOATTYPE e02,
|
||||
INLINE_LINMATH FLOATNAME(LMatrix3)();
|
||||
INLINE_LINMATH FLOATNAME(LMatrix3)(const FLOATNAME(LMatrix3) &other);
|
||||
INLINE_LINMATH FLOATNAME(LMatrix3) &operator = (const FLOATNAME(LMatrix3) &other);
|
||||
INLINE_LINMATH FLOATNAME(LMatrix3) &operator = (FLOATTYPE fill_value);
|
||||
INLINE_LINMATH FLOATNAME(LMatrix3)(FLOATTYPE e00, FLOATTYPE e01, FLOATTYPE e02,
|
||||
FLOATTYPE e10, FLOATTYPE e11, FLOATTYPE e12,
|
||||
FLOATTYPE e20, FLOATTYPE e21, FLOATTYPE e22);
|
||||
|
||||
void fill(FLOATTYPE fill_value);
|
||||
INLINE void set(FLOATTYPE e00, FLOATTYPE e01, FLOATTYPE e02,
|
||||
INLINE_LINMATH void set(FLOATTYPE e00, FLOATTYPE e01, FLOATTYPE e02,
|
||||
FLOATTYPE e10, FLOATTYPE e11, FLOATTYPE e12,
|
||||
FLOATTYPE e20, FLOATTYPE e21, FLOATTYPE e22);
|
||||
|
||||
INLINE void set_row(int row, const FLOATNAME(LVecBase3) &v);
|
||||
INLINE void set_col(int col, const FLOATNAME(LVecBase3) &v);
|
||||
INLINE_LINMATH void set_row(int row, const FLOATNAME(LVecBase3) &v);
|
||||
INLINE_LINMATH void set_col(int col, const FLOATNAME(LVecBase3) &v);
|
||||
|
||||
INLINE void set_row(int row, const FLOATNAME(LVecBase2) &v);
|
||||
INLINE void set_col(int col, const FLOATNAME(LVecBase2) &v);
|
||||
INLINE_LINMATH void set_row(int row, const FLOATNAME(LVecBase2) &v);
|
||||
INLINE_LINMATH void set_col(int col, const FLOATNAME(LVecBase2) &v);
|
||||
|
||||
INLINE FLOATNAME(LVecBase3) get_row(int row) const;
|
||||
INLINE FLOATNAME(LVecBase3) get_col(int col) const;
|
||||
INLINE_LINMATH FLOATNAME(LVecBase3) get_row(int row) const;
|
||||
INLINE_LINMATH FLOATNAME(LVecBase3) get_col(int col) const;
|
||||
|
||||
INLINE FLOATNAME(LVecBase2) get_row2(int row) const;
|
||||
INLINE FLOATNAME(LVecBase2) get_col2(int col) const;
|
||||
INLINE_LINMATH FLOATNAME(LVecBase2) get_row2(int row) const;
|
||||
INLINE_LINMATH FLOATNAME(LVecBase2) get_col2(int col) const;
|
||||
|
||||
INLINE FLOATTYPE &operator () (int row, int col);
|
||||
INLINE FLOATTYPE operator () (int row, int col) const;
|
||||
INLINE_LINMATH FLOATTYPE &operator () (int row, int col);
|
||||
INLINE_LINMATH FLOATTYPE operator () (int row, int col) const;
|
||||
|
||||
INLINE bool is_nan() const;
|
||||
INLINE_LINMATH bool is_nan() const;
|
||||
|
||||
INLINE FLOATTYPE get_cell(int row, int col) const;
|
||||
INLINE void set_cell(int row, int col, FLOATTYPE value);
|
||||
INLINE_LINMATH FLOATTYPE get_cell(int row, int col) const;
|
||||
INLINE_LINMATH void set_cell(int row, int col, FLOATTYPE value);
|
||||
|
||||
INLINE const FLOATTYPE *get_data() const;
|
||||
INLINE int get_num_components() const;
|
||||
INLINE_LINMATH const FLOATTYPE *get_data() const;
|
||||
INLINE_LINMATH int get_num_components() const;
|
||||
|
||||
public:
|
||||
INLINE iterator begin();
|
||||
INLINE iterator end();
|
||||
INLINE_LINMATH iterator begin();
|
||||
INLINE_LINMATH iterator end();
|
||||
|
||||
INLINE const_iterator begin() const;
|
||||
INLINE const_iterator end() const;
|
||||
INLINE_LINMATH const_iterator begin() const;
|
||||
INLINE_LINMATH const_iterator end() const;
|
||||
|
||||
PUBLISHED:
|
||||
INLINE bool operator < (const FLOATNAME(LMatrix3) &other) const;
|
||||
INLINE bool operator == (const FLOATNAME(LMatrix3) &other) const;
|
||||
INLINE bool operator != (const FLOATNAME(LMatrix3) &other) const;
|
||||
INLINE_LINMATH bool operator < (const FLOATNAME(LMatrix3) &other) const;
|
||||
INLINE_LINMATH bool operator == (const FLOATNAME(LMatrix3) &other) const;
|
||||
INLINE_LINMATH bool operator != (const FLOATNAME(LMatrix3) &other) const;
|
||||
|
||||
INLINE int compare_to(const FLOATNAME(LMatrix3) &other) const;
|
||||
INLINE_LINMATH int compare_to(const FLOATNAME(LMatrix3) &other) const;
|
||||
int compare_to(const FLOATNAME(LMatrix3) &other, FLOATTYPE threshold) const;
|
||||
|
||||
INLINE FLOATNAME(LVecBase3)
|
||||
INLINE_LINMATH FLOATNAME(LVecBase3)
|
||||
xform(const FLOATNAME(LVecBase3) &v) const;
|
||||
|
||||
INLINE FLOATNAME(LVecBase2)
|
||||
INLINE_LINMATH FLOATNAME(LVecBase2)
|
||||
xform_point(const FLOATNAME(LVecBase2) &v) const;
|
||||
|
||||
INLINE FLOATNAME(LVecBase2)
|
||||
INLINE_LINMATH FLOATNAME(LVecBase2)
|
||||
xform_vec(const FLOATNAME(LVecBase2) &v) const;
|
||||
|
||||
INLINE FLOATNAME(LMatrix3) operator * (const FLOATNAME(LMatrix3) &other) const;
|
||||
INLINE FLOATNAME(LMatrix3) operator * (FLOATTYPE scalar) const;
|
||||
INLINE FLOATNAME(LMatrix3) operator / (FLOATTYPE scalar) const;
|
||||
INLINE_LINMATH FLOATNAME(LMatrix3) operator * (const FLOATNAME(LMatrix3) &other) const;
|
||||
INLINE_LINMATH FLOATNAME(LMatrix3) operator * (FLOATTYPE scalar) const;
|
||||
INLINE_LINMATH FLOATNAME(LMatrix3) operator / (FLOATTYPE scalar) const;
|
||||
|
||||
INLINE FLOATNAME(LMatrix3) &operator += (const FLOATNAME(LMatrix3) &other);
|
||||
INLINE FLOATNAME(LMatrix3) &operator -= (const FLOATNAME(LMatrix3) &other);
|
||||
INLINE_LINMATH FLOATNAME(LMatrix3) &operator += (const FLOATNAME(LMatrix3) &other);
|
||||
INLINE_LINMATH FLOATNAME(LMatrix3) &operator -= (const FLOATNAME(LMatrix3) &other);
|
||||
|
||||
INLINE FLOATNAME(LMatrix3) &operator *= (const FLOATNAME(LMatrix3) &other);
|
||||
INLINE_LINMATH FLOATNAME(LMatrix3) &operator *= (const FLOATNAME(LMatrix3) &other);
|
||||
|
||||
INLINE FLOATNAME(LMatrix3) &operator *= (FLOATTYPE scalar);
|
||||
INLINE FLOATNAME(LMatrix3) &operator /= (FLOATTYPE scalar);
|
||||
INLINE_LINMATH FLOATNAME(LMatrix3) &operator *= (FLOATTYPE scalar);
|
||||
INLINE_LINMATH FLOATNAME(LMatrix3) &operator /= (FLOATTYPE scalar);
|
||||
|
||||
INLINE FLOATTYPE determinant() const;
|
||||
INLINE_LINMATH FLOATTYPE determinant() const;
|
||||
|
||||
INLINE void transpose_from(const FLOATNAME(LMatrix3) &other);
|
||||
INLINE void transpose_in_place();
|
||||
INLINE_LINMATH void transpose_from(const FLOATNAME(LMatrix3) &other);
|
||||
INLINE_LINMATH void transpose_in_place();
|
||||
|
||||
INLINE bool invert_from(const FLOATNAME(LMatrix3) &other);
|
||||
INLINE bool invert_in_place();
|
||||
INLINE_LINMATH bool invert_from(const FLOATNAME(LMatrix3) &other);
|
||||
INLINE_LINMATH bool invert_in_place();
|
||||
|
||||
static INLINE const FLOATNAME(LMatrix3) &ident_mat();
|
||||
static INLINE_LINMATH const FLOATNAME(LMatrix3) &ident_mat();
|
||||
|
||||
// A 3x3 matrix is likely to be used for one of two purposes. In
|
||||
// 2-d coordinate space (e.g. texture or surface coordinates), it
|
||||
|
|
@ -108,19 +108,19 @@ PUBLISHED:
|
|||
// The following named constructors return 3x3 matrices suitable for
|
||||
// affine transforms in 2-d coordinate space.
|
||||
|
||||
static INLINE FLOATNAME(LMatrix3) translate_mat(const FLOATNAME(LVecBase2) &trans);
|
||||
static INLINE FLOATNAME(LMatrix3) translate_mat(FLOATTYPE tx, FLOATTYPE ty);
|
||||
static INLINE FLOATNAME(LMatrix3) rotate_mat(FLOATTYPE angle);
|
||||
static INLINE FLOATNAME(LMatrix3) scale_mat(const FLOATNAME(LVecBase2) &scale);
|
||||
static INLINE FLOATNAME(LMatrix3) scale_mat(FLOATTYPE sx, FLOATTYPE sy);
|
||||
static INLINE_LINMATH FLOATNAME(LMatrix3) translate_mat(const FLOATNAME(LVecBase2) &trans);
|
||||
static INLINE_LINMATH FLOATNAME(LMatrix3) translate_mat(FLOATTYPE tx, FLOATTYPE ty);
|
||||
static INLINE_LINMATH FLOATNAME(LMatrix3) rotate_mat(FLOATTYPE angle);
|
||||
static INLINE_LINMATH FLOATNAME(LMatrix3) scale_mat(const FLOATNAME(LVecBase2) &scale);
|
||||
static INLINE_LINMATH FLOATNAME(LMatrix3) scale_mat(FLOATTYPE sx, FLOATTYPE sy);
|
||||
|
||||
// The following named constructors return 3x3 matrices suitable for
|
||||
// scale/rotate transforms in 3-d coordinate space.
|
||||
static INLINE FLOATNAME(LMatrix3) rotate_mat(FLOATTYPE angle,
|
||||
FLOATNAME(LVecBase3) axis,
|
||||
static INLINE_LINMATH FLOATNAME(LMatrix3) rotate_mat(FLOATTYPE angle,
|
||||
FLOATNAME(LVecBase3) &axis,
|
||||
CoordinateSystem cs = CS_default);
|
||||
static INLINE FLOATNAME(LMatrix3) scale_mat(const FLOATNAME(LVecBase3) &scale);
|
||||
static INLINE FLOATNAME(LMatrix3) scale_mat(FLOATTYPE sx, FLOATTYPE sy, FLOATTYPE sz);
|
||||
static INLINE_LINMATH FLOATNAME(LMatrix3) scale_mat(const FLOATNAME(LVecBase3) &scale);
|
||||
static INLINE_LINMATH FLOATNAME(LMatrix3) scale_mat(FLOATTYPE sx, FLOATTYPE sy, FLOATTYPE sz);
|
||||
|
||||
// We don't have a scale_mat() that takes a single uniform scale
|
||||
// parameter, because it would be ambiguous whether we mean a 2-d or
|
||||
|
|
@ -129,16 +129,27 @@ PUBLISHED:
|
|||
bool almost_equal(const FLOATNAME(LMatrix3) &other,
|
||||
FLOATTYPE threshold) const;
|
||||
|
||||
INLINE bool almost_equal(const FLOATNAME(LMatrix3) &other) const;
|
||||
INLINE_LINMATH bool almost_equal(const FLOATNAME(LMatrix3) &other) const;
|
||||
|
||||
INLINE void output(ostream &out) const;
|
||||
INLINE void write(ostream &out, int indent_level = 0) const;
|
||||
INLINE_LINMATH void output(ostream &out) const;
|
||||
INLINE_LINMATH void write(ostream &out, int indent_level = 0) const;
|
||||
|
||||
public:
|
||||
|
||||
union {
|
||||
struct {
|
||||
FLOATTYPE _00, _01, _02;
|
||||
FLOATTYPE _10, _11, _12;
|
||||
FLOATTYPE _20, _21, _22;
|
||||
} m;
|
||||
|
||||
FLOATTYPE data[3 * 3];
|
||||
} _m;
|
||||
|
||||
private:
|
||||
INLINE FLOATTYPE mult_cel(const FLOATNAME(LMatrix3) &other, int x, int y) const;
|
||||
INLINE FLOATTYPE det2(FLOATTYPE e00, FLOATTYPE e01, FLOATTYPE e10, FLOATTYPE e11) const;
|
||||
INLINE_LINMATH FLOATTYPE mult_cel(const FLOATNAME(LMatrix3) &other, int x, int y) const;
|
||||
INLINE_LINMATH FLOATTYPE det2(FLOATTYPE e00, FLOATTYPE e01, FLOATTYPE e10, FLOATTYPE e11) const;
|
||||
|
||||
FLOATTYPE _data[3 * 3];
|
||||
static FLOATNAME(LMatrix3) _ident_mat;
|
||||
|
||||
//Functionality for reading and writing from/to a binary source
|
||||
|
|
@ -157,12 +168,12 @@ private:
|
|||
};
|
||||
|
||||
|
||||
INLINE ostream &operator << (ostream &out, const FLOATNAME(LMatrix3) &mat) {
|
||||
INLINE_LINMATH ostream &operator << (ostream &out, const FLOATNAME(LMatrix3) &mat) {
|
||||
mat.output(out);
|
||||
return out;
|
||||
}
|
||||
|
||||
INLINE FLOATNAME(LMatrix3) transpose(const FLOATNAME(LMatrix3) &a);
|
||||
INLINE FLOATNAME(LMatrix3) invert(const FLOATNAME(LMatrix3) &a);
|
||||
INLINE_LINMATH FLOATNAME(LMatrix3) transpose(const FLOATNAME(LMatrix3) &a);
|
||||
INLINE_LINMATH FLOATNAME(LMatrix3) invert(const FLOATNAME(LMatrix3) &a);
|
||||
|
||||
#include "lmatrix3_src.I"
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -283,8 +283,8 @@ read_datagram(DatagramIterator &scan)
|
|||
int FLOATNAME(LMatrix4)::
|
||||
compare_to(const FLOATNAME(LMatrix4) &other, FLOATTYPE threshold) const {
|
||||
for (int i = 0; i < 16; i++) {
|
||||
if (!IS_THRESHOLD_EQUAL(_data[i], other._data[i], threshold)) {
|
||||
return (_data[i] < other._data[i]) ? -1 : 1;
|
||||
if (!IS_THRESHOLD_EQUAL(_m.data[i], other._m.data[i], threshold)) {
|
||||
return (_m.data[i] < other._m.data[i]) ? -1 : 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -13,124 +13,136 @@ PUBLISHED:
|
|||
typedef const FLOATTYPE *iterator;
|
||||
typedef const FLOATTYPE *const_iterator;
|
||||
|
||||
INLINE FLOATNAME(LMatrix4)();
|
||||
INLINE FLOATNAME(LMatrix4)(const FLOATNAME(LMatrix4) &other);
|
||||
INLINE FLOATNAME(LMatrix4) &operator = (const FLOATNAME(LMatrix4) &other);
|
||||
INLINE FLOATNAME(LMatrix4) &operator = (FLOATTYPE fill_value);
|
||||
INLINE_LINMATH FLOATNAME(LMatrix4)();
|
||||
INLINE_LINMATH FLOATNAME(LMatrix4)(const FLOATNAME(LMatrix4) &other);
|
||||
INLINE_LINMATH FLOATNAME(LMatrix4) &operator = (const FLOATNAME(LMatrix4) &other);
|
||||
INLINE_LINMATH FLOATNAME(LMatrix4) &operator = (FLOATTYPE fill_value);
|
||||
|
||||
INLINE FLOATNAME(LMatrix4)(FLOATTYPE e00, FLOATTYPE e01, FLOATTYPE e02, FLOATTYPE e03,
|
||||
INLINE_LINMATH FLOATNAME(LMatrix4)(FLOATTYPE e00, FLOATTYPE e01, FLOATTYPE e02, FLOATTYPE e03,
|
||||
FLOATTYPE e10, FLOATTYPE e11, FLOATTYPE e12, FLOATTYPE e13,
|
||||
FLOATTYPE e20, FLOATTYPE e21, FLOATTYPE e22, FLOATTYPE e23,
|
||||
FLOATTYPE e30, FLOATTYPE e31, FLOATTYPE e32, FLOATTYPE e33);
|
||||
|
||||
// Construct a 4x4 matrix given a 3x3 rotation matrix and an optional
|
||||
// translation component.
|
||||
INLINE FLOATNAME(LMatrix4)(const FLOATNAME(LMatrix3) &upper3);
|
||||
INLINE FLOATNAME(LMatrix4)(const FLOATNAME(LMatrix3) &upper3,const FLOATNAME(LVecBase3) &trans);
|
||||
INLINE_LINMATH FLOATNAME(LMatrix4)(const FLOATNAME(LMatrix3) &upper3);
|
||||
INLINE_LINMATH FLOATNAME(LMatrix4)(const FLOATNAME(LMatrix3) &upper3,const FLOATNAME(LVecBase3) &trans);
|
||||
|
||||
INLINE void fill(FLOATTYPE fill_value);
|
||||
INLINE void set(FLOATTYPE e00, FLOATTYPE e01, FLOATTYPE e02, FLOATTYPE e03,
|
||||
INLINE_LINMATH void fill(FLOATTYPE fill_value);
|
||||
INLINE_LINMATH void set(FLOATTYPE e00, FLOATTYPE e01, FLOATTYPE e02, FLOATTYPE e03,
|
||||
FLOATTYPE e10, FLOATTYPE e11, FLOATTYPE e12, FLOATTYPE e13,
|
||||
FLOATTYPE e20, FLOATTYPE e21, FLOATTYPE e22, FLOATTYPE e23,
|
||||
FLOATTYPE e30, FLOATTYPE e31, FLOATTYPE e32, FLOATTYPE e33);
|
||||
|
||||
// Get and set the upper 3x3 rotation matrix.
|
||||
INLINE void set_upper_3(const FLOATNAME(LMatrix3) &upper3);
|
||||
INLINE FLOATNAME(LMatrix3) get_upper_3() const;
|
||||
INLINE_LINMATH void set_upper_3(const FLOATNAME(LMatrix3) &upper3);
|
||||
INLINE_LINMATH FLOATNAME(LMatrix3) get_upper_3() const;
|
||||
|
||||
INLINE void set_row(int row, const FLOATNAME(LVecBase4) &v);
|
||||
INLINE void set_col(int col, const FLOATNAME(LVecBase4) &v);
|
||||
INLINE_LINMATH void set_row(int row, const FLOATNAME(LVecBase4) &v);
|
||||
INLINE_LINMATH void set_col(int col, const FLOATNAME(LVecBase4) &v);
|
||||
|
||||
INLINE void set_row(int row, const FLOATNAME(LVecBase3) &v);
|
||||
INLINE void set_col(int col, const FLOATNAME(LVecBase3) &v);
|
||||
INLINE_LINMATH void set_row(int row, const FLOATNAME(LVecBase3) &v);
|
||||
INLINE_LINMATH void set_col(int col, const FLOATNAME(LVecBase3) &v);
|
||||
|
||||
INLINE FLOATNAME(LVecBase4) get_row(int row) const;
|
||||
INLINE FLOATNAME(LVecBase4) get_col(int col) const;
|
||||
INLINE_LINMATH FLOATNAME(LVecBase4) get_row(int row) const;
|
||||
INLINE_LINMATH FLOATNAME(LVecBase4) get_col(int col) const;
|
||||
|
||||
INLINE FLOATNAME(LVecBase3) get_row3(int row) const;
|
||||
INLINE FLOATNAME(LVecBase3) get_col3(int col) const;
|
||||
INLINE_LINMATH FLOATNAME(LVecBase3) get_row3(int row) const;
|
||||
INLINE_LINMATH FLOATNAME(LVecBase3) get_col3(int col) const;
|
||||
|
||||
INLINE FLOATTYPE &operator () (int row, int col);
|
||||
INLINE FLOATTYPE operator () (int row, int col) const;
|
||||
INLINE_LINMATH FLOATTYPE &operator () (int row, int col);
|
||||
INLINE_LINMATH FLOATTYPE operator () (int row, int col) const;
|
||||
|
||||
INLINE bool is_nan() const;
|
||||
INLINE_LINMATH bool is_nan() const;
|
||||
|
||||
INLINE FLOATTYPE get_cell(int row, int col) const;
|
||||
INLINE void set_cell(int row, int col, FLOATTYPE value);
|
||||
INLINE_LINMATH FLOATTYPE get_cell(int row, int col) const;
|
||||
INLINE_LINMATH void set_cell(int row, int col, FLOATTYPE value);
|
||||
|
||||
INLINE const FLOATTYPE *get_data() const;
|
||||
INLINE int get_num_components() const;
|
||||
INLINE_LINMATH const FLOATTYPE *get_data() const;
|
||||
INLINE_LINMATH int get_num_components() const;
|
||||
|
||||
INLINE iterator begin();
|
||||
INLINE iterator end();
|
||||
INLINE_LINMATH iterator begin();
|
||||
INLINE_LINMATH iterator end();
|
||||
|
||||
INLINE const_iterator begin() const;
|
||||
INLINE const_iterator end() const;
|
||||
INLINE_LINMATH const_iterator begin() const;
|
||||
INLINE_LINMATH const_iterator end() const;
|
||||
|
||||
INLINE bool operator < (const FLOATNAME(LMatrix4) &other) const;
|
||||
INLINE bool operator == (const FLOATNAME(LMatrix4) &other) const;
|
||||
INLINE bool operator != (const FLOATNAME(LMatrix4) &other) const;
|
||||
INLINE_LINMATH bool operator < (const FLOATNAME(LMatrix4) &other) const;
|
||||
INLINE_LINMATH bool operator == (const FLOATNAME(LMatrix4) &other) const;
|
||||
INLINE_LINMATH bool operator != (const FLOATNAME(LMatrix4) &other) const;
|
||||
|
||||
INLINE int compare_to(const FLOATNAME(LMatrix4) &other) const;
|
||||
INLINE_LINMATH int compare_to(const FLOATNAME(LMatrix4) &other) const;
|
||||
int compare_to(const FLOATNAME(LMatrix4) &other, FLOATTYPE threshold) const;
|
||||
|
||||
INLINE FLOATNAME(LVecBase4)
|
||||
INLINE_LINMATH FLOATNAME(LVecBase4)
|
||||
xform(const FLOATNAME(LVecBase4) &v) const;
|
||||
|
||||
INLINE FLOATNAME(LVecBase3)
|
||||
INLINE_LINMATH FLOATNAME(LVecBase3)
|
||||
xform_point(const FLOATNAME(LVecBase3) &v) const;
|
||||
|
||||
INLINE FLOATNAME(LVecBase3)
|
||||
INLINE_LINMATH FLOATNAME(LVecBase3)
|
||||
xform_vec(const FLOATNAME(LVecBase3) &v) const;
|
||||
|
||||
INLINE FLOATNAME(LMatrix4) operator * (const FLOATNAME(LMatrix4) &other) const;
|
||||
INLINE FLOATNAME(LMatrix4) operator * (FLOATTYPE scalar) const;
|
||||
INLINE FLOATNAME(LMatrix4) operator / (FLOATTYPE scalar) const;
|
||||
INLINE_LINMATH FLOATNAME(LMatrix4) operator * (const FLOATNAME(LMatrix4) &other) const;
|
||||
INLINE_LINMATH FLOATNAME(LMatrix4) operator * (FLOATTYPE scalar) const;
|
||||
INLINE_LINMATH FLOATNAME(LMatrix4) operator / (FLOATTYPE scalar) const;
|
||||
|
||||
INLINE FLOATNAME(LMatrix4) &operator += (const FLOATNAME(LMatrix4) &other);
|
||||
INLINE FLOATNAME(LMatrix4) &operator -= (const FLOATNAME(LMatrix4) &other);
|
||||
INLINE_LINMATH FLOATNAME(LMatrix4) &operator += (const FLOATNAME(LMatrix4) &other);
|
||||
INLINE_LINMATH FLOATNAME(LMatrix4) &operator -= (const FLOATNAME(LMatrix4) &other);
|
||||
|
||||
INLINE FLOATNAME(LMatrix4) &operator *= (const FLOATNAME(LMatrix4) &other);
|
||||
INLINE_LINMATH FLOATNAME(LMatrix4) &operator *= (const FLOATNAME(LMatrix4) &other);
|
||||
|
||||
INLINE FLOATNAME(LMatrix4) &operator *= (FLOATTYPE scalar);
|
||||
INLINE FLOATNAME(LMatrix4) &operator /= (FLOATTYPE scalar);
|
||||
INLINE_LINMATH FLOATNAME(LMatrix4) &operator *= (FLOATTYPE scalar);
|
||||
INLINE_LINMATH FLOATNAME(LMatrix4) &operator /= (FLOATTYPE scalar);
|
||||
|
||||
INLINE void transpose_from(const FLOATNAME(LMatrix4) &other);
|
||||
INLINE void transpose_in_place();
|
||||
INLINE_LINMATH void transpose_from(const FLOATNAME(LMatrix4) &other);
|
||||
INLINE_LINMATH void transpose_in_place();
|
||||
|
||||
INLINE bool invert_from(const FLOATNAME(LMatrix4) &other);
|
||||
INLINE bool invert_affine_from(const FLOATNAME(LMatrix4) &other);
|
||||
INLINE bool invert_in_place();
|
||||
INLINE_LINMATH bool invert_from(const FLOATNAME(LMatrix4) &other);
|
||||
INLINE_LINMATH bool invert_affine_from(const FLOATNAME(LMatrix4) &other);
|
||||
INLINE_LINMATH bool invert_in_place();
|
||||
|
||||
INLINE static const FLOATNAME(LMatrix4) &ident_mat();
|
||||
INLINE static FLOATNAME(LMatrix4) translate_mat(const FLOATNAME(LVecBase3) &trans);
|
||||
INLINE static FLOATNAME(LMatrix4) translate_mat(FLOATTYPE tx, FLOATTYPE ty, FLOATTYPE tz);
|
||||
INLINE static FLOATNAME(LMatrix4) rotate_mat(FLOATTYPE angle,
|
||||
FLOATNAME(LVecBase3) axis,
|
||||
INLINE_LINMATH static const FLOATNAME(LMatrix4) &ident_mat();
|
||||
INLINE_LINMATH static FLOATNAME(LMatrix4) translate_mat(const FLOATNAME(LVecBase3) &trans);
|
||||
INLINE_LINMATH static FLOATNAME(LMatrix4) translate_mat(FLOATTYPE tx, FLOATTYPE ty, FLOATTYPE tz);
|
||||
INLINE_LINMATH static FLOATNAME(LMatrix4) rotate_mat(FLOATTYPE angle,
|
||||
FLOATNAME(LVecBase3) &axis,
|
||||
CoordinateSystem cs = CS_default);
|
||||
INLINE static FLOATNAME(LMatrix4) scale_mat(const FLOATNAME(LVecBase3) &scale);
|
||||
INLINE static FLOATNAME(LMatrix4) scale_mat(FLOATTYPE sx, FLOATTYPE sy, FLOATTYPE sz);
|
||||
INLINE static FLOATNAME(LMatrix4) scale_mat(FLOATTYPE scale);
|
||||
INLINE_LINMATH static FLOATNAME(LMatrix4) scale_mat(const FLOATNAME(LVecBase3) &scale);
|
||||
INLINE_LINMATH static FLOATNAME(LMatrix4) scale_mat(FLOATTYPE sx, FLOATTYPE sy, FLOATTYPE sz);
|
||||
INLINE_LINMATH static FLOATNAME(LMatrix4) scale_mat(FLOATTYPE scale);
|
||||
|
||||
INLINE static const FLOATNAME(LMatrix4) &y_to_z_up_mat();
|
||||
INLINE static const FLOATNAME(LMatrix4) &z_to_y_up_mat();
|
||||
INLINE_LINMATH static const FLOATNAME(LMatrix4) &y_to_z_up_mat();
|
||||
INLINE_LINMATH static const FLOATNAME(LMatrix4) &z_to_y_up_mat();
|
||||
|
||||
static FLOATNAME(LMatrix4) convert_mat(CoordinateSystem from,
|
||||
CoordinateSystem to);
|
||||
|
||||
bool almost_equal(const FLOATNAME(LMatrix4) &other,
|
||||
FLOATTYPE threshold) const;
|
||||
INLINE bool almost_equal(const FLOATNAME(LMatrix4) &other) const;
|
||||
INLINE_LINMATH bool almost_equal(const FLOATNAME(LMatrix4) &other) const;
|
||||
|
||||
INLINE void output(ostream &out) const;
|
||||
INLINE void write(ostream &out, int indent_level = 0) const;
|
||||
INLINE_LINMATH void output(ostream &out) const;
|
||||
INLINE_LINMATH void write(ostream &out, int indent_level = 0) const;
|
||||
|
||||
public:
|
||||
|
||||
union {
|
||||
struct {
|
||||
FLOATTYPE _00, _01, _02, _03;
|
||||
FLOATTYPE _10, _11, _12, _13;
|
||||
FLOATTYPE _20, _21, _22, _23;
|
||||
FLOATTYPE _30, _31, _32, _33;
|
||||
} m;
|
||||
|
||||
FLOATTYPE data[4 * 4];
|
||||
} _m;
|
||||
|
||||
private:
|
||||
INLINE FLOATTYPE mult_cel(const FLOATNAME(LMatrix4) &other, int x, int y) const;
|
||||
INLINE_LINMATH FLOATTYPE mult_cel(const FLOATNAME(LMatrix4) &other, int x, int y) const;
|
||||
bool decompose_mat(int index[4]);
|
||||
bool back_sub_mat(int index[4], FLOATNAME(LMatrix4) &inv, int row) const;
|
||||
|
||||
FLOATTYPE _data[4 * 4];
|
||||
static const FLOATNAME(LMatrix4) _ident_mat;
|
||||
static const FLOATNAME(LMatrix4) _y_to_z_up_mat;
|
||||
static const FLOATNAME(LMatrix4) _z_to_y_up_mat;
|
||||
|
|
@ -150,12 +162,14 @@ private:
|
|||
static TypeHandle _type_handle;
|
||||
};
|
||||
|
||||
INLINE ostream &operator << (ostream &out, const FLOATNAME(LMatrix4) &mat) {
|
||||
|
||||
INLINE_LINMATH ostream &operator << (ostream &out, const FLOATNAME(LMatrix4) &mat) {
|
||||
mat.output(out);
|
||||
return out;
|
||||
}
|
||||
|
||||
INLINE FLOATNAME(LMatrix4) transpose(const FLOATNAME(LMatrix4) &a);
|
||||
INLINE FLOATNAME(LMatrix4) invert(const FLOATNAME(LMatrix4) &a);
|
||||
|
||||
INLINE_LINMATH FLOATNAME(LMatrix4) transpose(const FLOATNAME(LMatrix4) &a);
|
||||
INLINE_LINMATH FLOATNAME(LMatrix4) invert(const FLOATNAME(LMatrix4) &a);
|
||||
|
||||
#include "lmatrix4_src.I"
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
// Access: public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LOrientation)::
|
||||
INLINE_LINMATH FLOATNAME(LOrientation)::
|
||||
FLOATNAME(LOrientation)() {
|
||||
}
|
||||
|
||||
|
|
@ -17,7 +17,7 @@ FLOATNAME(LOrientation)() {
|
|||
// Access: public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LOrientation)::
|
||||
INLINE_LINMATH FLOATNAME(LOrientation)::
|
||||
FLOATNAME(LOrientation)(const FLOATNAME(LQuaternion)& c) :
|
||||
FLOATNAME(LQuaternion)(c) {
|
||||
}
|
||||
|
|
@ -27,7 +27,7 @@ FLOATNAME(LOrientation)(const FLOATNAME(LQuaternion)& c) :
|
|||
// Access: public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LOrientation)::
|
||||
INLINE_LINMATH FLOATNAME(LOrientation)::
|
||||
FLOATNAME(LOrientation)(FLOATTYPE r, FLOATTYPE i, FLOATTYPE j, FLOATTYPE k) :
|
||||
FLOATNAME(LQuaternion)(r, i, j, k) {
|
||||
}
|
||||
|
|
@ -37,7 +37,7 @@ FLOATNAME(LOrientation)(FLOATTYPE r, FLOATTYPE i, FLOATTYPE j, FLOATTYPE k) :
|
|||
// Access: public
|
||||
// Description: vector + twist
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LOrientation)::
|
||||
INLINE_LINMATH FLOATNAME(LOrientation)::
|
||||
FLOATNAME(LOrientation)(const FLOATNAME(LVector3) &point_at, float twist) {
|
||||
float radians = twist * ((float) MathNumbers::pi / 180.0f);
|
||||
float theta_over_2 = radians / 2.0f;
|
||||
|
|
@ -54,7 +54,7 @@ FLOATNAME(LOrientation)(const FLOATNAME(LVector3) &point_at, float twist) {
|
|||
// Access: public
|
||||
// Description: matrix3
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LOrientation)::
|
||||
INLINE_LINMATH FLOATNAME(LOrientation)::
|
||||
FLOATNAME(LOrientation)(const FLOATNAME(LMatrix3) &m) {
|
||||
set_from_matrix(m);
|
||||
}
|
||||
|
|
@ -64,7 +64,7 @@ FLOATNAME(LOrientation)(const FLOATNAME(LMatrix3) &m) {
|
|||
// Access: public
|
||||
// Description: matrix4
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LOrientation)::
|
||||
INLINE_LINMATH FLOATNAME(LOrientation)::
|
||||
FLOATNAME(LOrientation)(const FLOATNAME(LMatrix4) &m) {
|
||||
set_from_matrix(m);
|
||||
}
|
||||
|
|
@ -75,7 +75,7 @@ FLOATNAME(LOrientation)(const FLOATNAME(LMatrix4) &m) {
|
|||
// Description: Orientation * rotation = Orientation
|
||||
// Applies an rotation to an orientation.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LOrientation) FLOATNAME(LOrientation)::
|
||||
INLINE_LINMATH FLOATNAME(LOrientation) FLOATNAME(LOrientation)::
|
||||
operator *(const FLOATNAME(LQuaternion)& other) const {
|
||||
return multiply(other);
|
||||
}
|
||||
|
|
@ -87,7 +87,7 @@ operator *(const FLOATNAME(LQuaternion)& other) const {
|
|||
// This is a meaningless operation, and will always
|
||||
// simply return the rhs.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LOrientation) FLOATNAME(LOrientation)::
|
||||
INLINE_LINMATH FLOATNAME(LOrientation) FLOATNAME(LOrientation)::
|
||||
operator *(const FLOATNAME(LOrientation)& other) const {
|
||||
return other;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,17 +9,17 @@
|
|||
////////////////////////////////////////////////////////////////////////
|
||||
class EXPCL_PANDA FLOATNAME(LOrientation) : public FLOATNAME(LQuaternion) {
|
||||
public:
|
||||
INLINE FLOATNAME(LOrientation)();
|
||||
INLINE FLOATNAME(LOrientation)(const FLOATNAME(LQuaternion)&);
|
||||
INLINE FLOATNAME(LOrientation)(FLOATTYPE, FLOATTYPE, FLOATTYPE, FLOATTYPE);
|
||||
INLINE FLOATNAME(LOrientation)(const FLOATNAME(LVector3) &, float);
|
||||
INLINE FLOATNAME(LOrientation)(const FLOATNAME(LMatrix3) &);
|
||||
INLINE FLOATNAME(LOrientation)(const FLOATNAME(LMatrix4) &);
|
||||
INLINE_LINMATH FLOATNAME(LOrientation)();
|
||||
INLINE_LINMATH FLOATNAME(LOrientation)(const FLOATNAME(LQuaternion)&);
|
||||
INLINE_LINMATH FLOATNAME(LOrientation)(FLOATTYPE, FLOATTYPE, FLOATTYPE, FLOATTYPE);
|
||||
INLINE_LINMATH FLOATNAME(LOrientation)(const FLOATNAME(LVector3) &, float);
|
||||
INLINE_LINMATH FLOATNAME(LOrientation)(const FLOATNAME(LMatrix3) &);
|
||||
INLINE_LINMATH FLOATNAME(LOrientation)(const FLOATNAME(LMatrix4) &);
|
||||
|
||||
INLINE FLOATNAME(LOrientation)
|
||||
INLINE_LINMATH FLOATNAME(LOrientation)
|
||||
operator *(const FLOATNAME(LQuaternion)& other) const;
|
||||
|
||||
INLINE FLOATNAME(LOrientation)
|
||||
INLINE_LINMATH FLOATNAME(LOrientation)
|
||||
operator *(const FLOATNAME(LOrientation)& other) const;
|
||||
|
||||
public:
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LPoint2)::
|
||||
INLINE_LINMATH FLOATNAME(LPoint2)::
|
||||
FLOATNAME(LPoint2)() {
|
||||
}
|
||||
|
||||
|
|
@ -18,7 +18,7 @@ FLOATNAME(LPoint2)() {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LPoint2)::
|
||||
INLINE_LINMATH FLOATNAME(LPoint2)::
|
||||
FLOATNAME(LPoint2)(const FLOATNAME(LVecBase2) ©) : FLOATNAME(LVecBase2)(copy) {
|
||||
}
|
||||
|
||||
|
|
@ -27,7 +27,7 @@ FLOATNAME(LPoint2)(const FLOATNAME(LVecBase2) ©) : FLOATNAME(LVecBase2)(copy
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LPoint2) &FLOATNAME(LPoint2)::
|
||||
INLINE_LINMATH FLOATNAME(LPoint2) &FLOATNAME(LPoint2)::
|
||||
operator = (const FLOATNAME(LVecBase2) ©) {
|
||||
FLOATNAME(LVecBase2)::operator = (copy);
|
||||
return *this;
|
||||
|
|
@ -38,7 +38,7 @@ operator = (const FLOATNAME(LVecBase2) ©) {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LPoint2) &FLOATNAME(LPoint2)::
|
||||
INLINE_LINMATH FLOATNAME(LPoint2) &FLOATNAME(LPoint2)::
|
||||
operator = (FLOATTYPE fill_value) {
|
||||
FLOATNAME(LVecBase2)::operator = (fill_value);
|
||||
return *this;
|
||||
|
|
@ -49,7 +49,7 @@ operator = (FLOATTYPE fill_value) {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LPoint2)::
|
||||
INLINE_LINMATH FLOATNAME(LPoint2)::
|
||||
FLOATNAME(LPoint2)(FLOATTYPE fill_value) :
|
||||
FLOATNAME(LVecBase2)(fill_value)
|
||||
{
|
||||
|
|
@ -60,7 +60,7 @@ FLOATNAME(LPoint2)(FLOATTYPE fill_value) :
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LPoint2)::
|
||||
INLINE_LINMATH FLOATNAME(LPoint2)::
|
||||
FLOATNAME(LPoint2)(FLOATTYPE x, FLOATTYPE y) :
|
||||
FLOATNAME(LVecBase2)(x, y)
|
||||
{
|
||||
|
|
@ -71,7 +71,7 @@ FLOATNAME(LPoint2)(FLOATTYPE x, FLOATTYPE y) :
|
|||
// Access: Public
|
||||
// Description: Returns a zero-length point.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE const FLOATNAME(LPoint2) &FLOATNAME(LPoint2)::
|
||||
INLINE_LINMATH const FLOATNAME(LPoint2) &FLOATNAME(LPoint2)::
|
||||
zero() {
|
||||
return (const FLOATNAME(LPoint2) &)FLOATNAME(LVecBase2)::zero();
|
||||
}
|
||||
|
|
@ -81,7 +81,7 @@ zero() {
|
|||
// Access: Public
|
||||
// Description: Returns a unit X point.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE const FLOATNAME(LPoint2) &FLOATNAME(LPoint2)::
|
||||
INLINE_LINMATH const FLOATNAME(LPoint2) &FLOATNAME(LPoint2)::
|
||||
unit_x() {
|
||||
return (const FLOATNAME(LPoint2) &)FLOATNAME(LVecBase2)::unit_x();
|
||||
}
|
||||
|
|
@ -91,7 +91,7 @@ unit_x() {
|
|||
// Access: Public
|
||||
// Description: Returns a unit Y point.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE const FLOATNAME(LPoint2) &FLOATNAME(LPoint2)::
|
||||
INLINE_LINMATH const FLOATNAME(LPoint2) &FLOATNAME(LPoint2)::
|
||||
unit_y() {
|
||||
return (const FLOATNAME(LPoint2) &)FLOATNAME(LVecBase2)::unit_y();
|
||||
}
|
||||
|
|
@ -101,7 +101,7 @@ unit_y() {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LPoint2) FLOATNAME(LPoint2)::
|
||||
INLINE_LINMATH FLOATNAME(LPoint2) FLOATNAME(LPoint2)::
|
||||
operator - () const {
|
||||
return FLOATNAME(LVecBase2)::operator - ();
|
||||
}
|
||||
|
|
@ -111,7 +111,7 @@ operator - () const {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVecBase2) FLOATNAME(LPoint2)::
|
||||
INLINE_LINMATH FLOATNAME(LVecBase2) FLOATNAME(LPoint2)::
|
||||
operator + (const FLOATNAME(LVecBase2) &other) const {
|
||||
return FLOATNAME(LVecBase2)::operator + (other);
|
||||
}
|
||||
|
|
@ -121,7 +121,7 @@ operator + (const FLOATNAME(LVecBase2) &other) const {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LPoint2) FLOATNAME(LPoint2)::
|
||||
INLINE_LINMATH FLOATNAME(LPoint2) FLOATNAME(LPoint2)::
|
||||
operator + (const FLOATNAME(LVector2) &other) const {
|
||||
return FLOATNAME(LVecBase2)::operator + (other);
|
||||
}
|
||||
|
|
@ -131,7 +131,7 @@ operator + (const FLOATNAME(LVector2) &other) const {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVecBase2) FLOATNAME(LPoint2)::
|
||||
INLINE_LINMATH FLOATNAME(LVecBase2) FLOATNAME(LPoint2)::
|
||||
operator - (const FLOATNAME(LVecBase2) &other) const {
|
||||
return FLOATNAME(LVecBase2)::operator - (other);
|
||||
}
|
||||
|
|
@ -141,7 +141,7 @@ operator - (const FLOATNAME(LVecBase2) &other) const {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVector2) FLOATNAME(LPoint2)::
|
||||
INLINE_LINMATH FLOATNAME(LVector2) FLOATNAME(LPoint2)::
|
||||
operator - (const FLOATNAME(LPoint2) &other) const {
|
||||
return FLOATNAME(LVecBase2)::operator - (other);
|
||||
}
|
||||
|
|
@ -151,7 +151,7 @@ operator - (const FLOATNAME(LPoint2) &other) const {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LPoint2) FLOATNAME(LPoint2)::
|
||||
INLINE_LINMATH FLOATNAME(LPoint2) FLOATNAME(LPoint2)::
|
||||
operator - (const FLOATNAME(LVector2) &other) const {
|
||||
return FLOATNAME(LVecBase2)::operator - (other);
|
||||
}
|
||||
|
|
@ -161,7 +161,7 @@ operator - (const FLOATNAME(LVector2) &other) const {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LPoint2) FLOATNAME(LPoint2)::
|
||||
INLINE_LINMATH FLOATNAME(LPoint2) FLOATNAME(LPoint2)::
|
||||
operator * (FLOATTYPE scalar) const {
|
||||
return FLOATNAME(LPoint2)(FLOATNAME(LVecBase2)::operator * (scalar));
|
||||
}
|
||||
|
|
@ -171,7 +171,7 @@ operator * (FLOATTYPE scalar) const {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LPoint2) FLOATNAME(LPoint2)::
|
||||
INLINE_LINMATH FLOATNAME(LPoint2) FLOATNAME(LPoint2)::
|
||||
operator / (FLOATTYPE scalar) const {
|
||||
return FLOATNAME(LPoint2)(FLOATNAME(LVecBase2)::operator / (scalar));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,33 +10,33 @@
|
|||
////////////////////////////////////////////////////////////////////
|
||||
class EXPCL_PANDA FLOATNAME(LPoint2) : public FLOATNAME(LVecBase2) {
|
||||
PUBLISHED:
|
||||
INLINE FLOATNAME(LPoint2)();
|
||||
INLINE FLOATNAME(LPoint2)(const FLOATNAME(LVecBase2) ©);
|
||||
INLINE FLOATNAME(LPoint2) &operator = (const FLOATNAME(LVecBase2) ©);
|
||||
INLINE FLOATNAME(LPoint2) &operator = (FLOATTYPE fill_value);
|
||||
INLINE FLOATNAME(LPoint2)(FLOATTYPE fill_value);
|
||||
INLINE FLOATNAME(LPoint2)(FLOATTYPE x, FLOATTYPE y);
|
||||
INLINE_LINMATH FLOATNAME(LPoint2)();
|
||||
INLINE_LINMATH FLOATNAME(LPoint2)(const FLOATNAME(LVecBase2) ©);
|
||||
INLINE_LINMATH FLOATNAME(LPoint2) &operator = (const FLOATNAME(LVecBase2) ©);
|
||||
INLINE_LINMATH FLOATNAME(LPoint2) &operator = (FLOATTYPE fill_value);
|
||||
INLINE_LINMATH FLOATNAME(LPoint2)(FLOATTYPE fill_value);
|
||||
INLINE_LINMATH FLOATNAME(LPoint2)(FLOATTYPE x, FLOATTYPE y);
|
||||
|
||||
INLINE static const FLOATNAME(LPoint2) &zero();
|
||||
INLINE static const FLOATNAME(LPoint2) &unit_x();
|
||||
INLINE static const FLOATNAME(LPoint2) &unit_y();
|
||||
INLINE_LINMATH static const FLOATNAME(LPoint2) &zero();
|
||||
INLINE_LINMATH static const FLOATNAME(LPoint2) &unit_x();
|
||||
INLINE_LINMATH static const FLOATNAME(LPoint2) &unit_y();
|
||||
|
||||
INLINE FLOATNAME(LPoint2) operator - () const;
|
||||
INLINE_LINMATH FLOATNAME(LPoint2) operator - () const;
|
||||
|
||||
INLINE FLOATNAME(LVecBase2)
|
||||
INLINE_LINMATH FLOATNAME(LVecBase2)
|
||||
operator + (const FLOATNAME(LVecBase2) &other) const;
|
||||
INLINE FLOATNAME(LPoint2)
|
||||
INLINE_LINMATH FLOATNAME(LPoint2)
|
||||
operator + (const FLOATNAME(LVector2) &other) const;
|
||||
|
||||
INLINE FLOATNAME(LVecBase2)
|
||||
INLINE_LINMATH FLOATNAME(LVecBase2)
|
||||
operator - (const FLOATNAME(LVecBase2) &other) const;
|
||||
INLINE FLOATNAME(LVector2)
|
||||
INLINE_LINMATH FLOATNAME(LVector2)
|
||||
operator - (const FLOATNAME(LPoint2) &other) const;
|
||||
INLINE FLOATNAME(LPoint2)
|
||||
INLINE_LINMATH FLOATNAME(LPoint2)
|
||||
operator - (const FLOATNAME(LVector2) &other) const;
|
||||
|
||||
INLINE FLOATNAME(LPoint2) operator * (FLOATTYPE scalar) const;
|
||||
INLINE FLOATNAME(LPoint2) operator / (FLOATTYPE scalar) const;
|
||||
INLINE_LINMATH FLOATNAME(LPoint2) operator * (FLOATTYPE scalar) const;
|
||||
INLINE_LINMATH FLOATNAME(LPoint2) operator / (FLOATTYPE scalar) const;
|
||||
|
||||
public:
|
||||
static TypeHandle get_class_type() {
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LPoint3)::
|
||||
INLINE_LINMATH FLOATNAME(LPoint3)::
|
||||
FLOATNAME(LPoint3)() {
|
||||
}
|
||||
|
||||
|
|
@ -18,7 +18,7 @@ FLOATNAME(LPoint3)() {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LPoint3)::
|
||||
INLINE_LINMATH FLOATNAME(LPoint3)::
|
||||
FLOATNAME(LPoint3)(const FLOATNAME(LVecBase3) ©) : FLOATNAME(LVecBase3)(copy) {
|
||||
}
|
||||
|
||||
|
|
@ -27,7 +27,7 @@ FLOATNAME(LPoint3)(const FLOATNAME(LVecBase3) ©) : FLOATNAME(LVecBase3)(copy
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LPoint3) &FLOATNAME(LPoint3)::
|
||||
INLINE_LINMATH FLOATNAME(LPoint3) &FLOATNAME(LPoint3)::
|
||||
operator = (const FLOATNAME(LVecBase3) ©) {
|
||||
FLOATNAME(LVecBase3)::operator = (copy);
|
||||
return *this;
|
||||
|
|
@ -38,7 +38,7 @@ operator = (const FLOATNAME(LVecBase3) ©) {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LPoint3) &FLOATNAME(LPoint3)::
|
||||
INLINE_LINMATH FLOATNAME(LPoint3) &FLOATNAME(LPoint3)::
|
||||
operator = (FLOATTYPE fill_value) {
|
||||
FLOATNAME(LVecBase3)::operator = (fill_value);
|
||||
return *this;
|
||||
|
|
@ -49,7 +49,7 @@ operator = (FLOATTYPE fill_value) {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LPoint3)::
|
||||
INLINE_LINMATH FLOATNAME(LPoint3)::
|
||||
FLOATNAME(LPoint3)(FLOATTYPE fill_value) :
|
||||
FLOATNAME(LVecBase3)(fill_value)
|
||||
{
|
||||
|
|
@ -60,7 +60,7 @@ FLOATNAME(LPoint3)(FLOATTYPE fill_value) :
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LPoint3)::
|
||||
INLINE_LINMATH FLOATNAME(LPoint3)::
|
||||
FLOATNAME(LPoint3)(FLOATTYPE x, FLOATTYPE y, FLOATTYPE z) :
|
||||
FLOATNAME(LVecBase3)(x, y, z)
|
||||
{
|
||||
|
|
@ -71,7 +71,7 @@ FLOATNAME(LPoint3)(FLOATTYPE x, FLOATTYPE y, FLOATTYPE z) :
|
|||
// Access: Public
|
||||
// Description: Returns a zero-length point.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE const FLOATNAME(LPoint3) &FLOATNAME(LPoint3)::
|
||||
INLINE_LINMATH const FLOATNAME(LPoint3) &FLOATNAME(LPoint3)::
|
||||
zero() {
|
||||
return (const FLOATNAME(LPoint3) &)FLOATNAME(LVecBase3)::zero();
|
||||
}
|
||||
|
|
@ -81,7 +81,7 @@ zero() {
|
|||
// Access: Public
|
||||
// Description: Returns a unit X point.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE const FLOATNAME(LPoint3) &FLOATNAME(LPoint3)::
|
||||
INLINE_LINMATH const FLOATNAME(LPoint3) &FLOATNAME(LPoint3)::
|
||||
unit_x() {
|
||||
return (const FLOATNAME(LPoint3) &)FLOATNAME(LVecBase3)::unit_x();
|
||||
}
|
||||
|
|
@ -91,7 +91,7 @@ unit_x() {
|
|||
// Access: Public
|
||||
// Description: Returns a unit Y point.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE const FLOATNAME(LPoint3) &FLOATNAME(LPoint3)::
|
||||
INLINE_LINMATH const FLOATNAME(LPoint3) &FLOATNAME(LPoint3)::
|
||||
unit_y() {
|
||||
return (const FLOATNAME(LPoint3) &)FLOATNAME(LVecBase3)::unit_y();
|
||||
}
|
||||
|
|
@ -101,7 +101,7 @@ unit_y() {
|
|||
// Access: Public
|
||||
// Description: Returns a unit Z point.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE const FLOATNAME(LPoint3) &FLOATNAME(LPoint3)::
|
||||
INLINE_LINMATH const FLOATNAME(LPoint3) &FLOATNAME(LPoint3)::
|
||||
unit_z() {
|
||||
return (const FLOATNAME(LPoint3) &)FLOATNAME(LVecBase3)::unit_z();
|
||||
}
|
||||
|
|
@ -111,7 +111,7 @@ unit_z() {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LPoint3) FLOATNAME(LPoint3)::
|
||||
INLINE_LINMATH FLOATNAME(LPoint3) FLOATNAME(LPoint3)::
|
||||
operator - () const {
|
||||
return FLOATNAME(LVecBase3)::operator - ();
|
||||
}
|
||||
|
|
@ -121,7 +121,7 @@ operator - () const {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVecBase3) FLOATNAME(LPoint3)::
|
||||
INLINE_LINMATH FLOATNAME(LVecBase3) FLOATNAME(LPoint3)::
|
||||
operator + (const FLOATNAME(LVecBase3) &other) const {
|
||||
return FLOATNAME(LVecBase3)::operator + (other);
|
||||
}
|
||||
|
|
@ -131,7 +131,7 @@ operator + (const FLOATNAME(LVecBase3) &other) const {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LPoint3) FLOATNAME(LPoint3)::
|
||||
INLINE_LINMATH FLOATNAME(LPoint3) FLOATNAME(LPoint3)::
|
||||
operator + (const FLOATNAME(LVector3) &other) const {
|
||||
return FLOATNAME(LVecBase3)::operator + (other);
|
||||
}
|
||||
|
|
@ -141,7 +141,7 @@ operator + (const FLOATNAME(LVector3) &other) const {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVecBase3) FLOATNAME(LPoint3)::
|
||||
INLINE_LINMATH FLOATNAME(LVecBase3) FLOATNAME(LPoint3)::
|
||||
operator - (const FLOATNAME(LVecBase3) &other) const {
|
||||
return FLOATNAME(LVecBase3)::operator - (other);
|
||||
}
|
||||
|
|
@ -151,7 +151,7 @@ operator - (const FLOATNAME(LVecBase3) &other) const {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVector3) FLOATNAME(LPoint3)::
|
||||
INLINE_LINMATH FLOATNAME(LVector3) FLOATNAME(LPoint3)::
|
||||
operator - (const FLOATNAME(LPoint3) &other) const {
|
||||
return FLOATNAME(LVecBase3)::operator - (other);
|
||||
}
|
||||
|
|
@ -161,7 +161,7 @@ operator - (const FLOATNAME(LPoint3) &other) const {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LPoint3) FLOATNAME(LPoint3)::
|
||||
INLINE_LINMATH FLOATNAME(LPoint3) FLOATNAME(LPoint3)::
|
||||
operator - (const FLOATNAME(LVector3) &other) const {
|
||||
return FLOATNAME(LVecBase3)::operator - (other);
|
||||
}
|
||||
|
|
@ -171,7 +171,7 @@ operator - (const FLOATNAME(LVector3) &other) const {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LPoint3) FLOATNAME(LPoint3)::
|
||||
INLINE_LINMATH FLOATNAME(LPoint3) FLOATNAME(LPoint3)::
|
||||
cross(const FLOATNAME(LVecBase3) &other) const {
|
||||
return FLOATNAME(LVecBase3)::cross(other);
|
||||
}
|
||||
|
|
@ -181,7 +181,7 @@ cross(const FLOATNAME(LVecBase3) &other) const {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LPoint3) FLOATNAME(LPoint3)::
|
||||
INLINE_LINMATH FLOATNAME(LPoint3) FLOATNAME(LPoint3)::
|
||||
operator * (FLOATTYPE scalar) const {
|
||||
return FLOATNAME(LPoint3)(FLOATNAME(LVecBase3)::operator * (scalar));
|
||||
}
|
||||
|
|
@ -191,7 +191,7 @@ operator * (FLOATTYPE scalar) const {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LPoint3) FLOATNAME(LPoint3)::
|
||||
INLINE_LINMATH FLOATNAME(LPoint3) FLOATNAME(LPoint3)::
|
||||
operator / (FLOATTYPE scalar) const {
|
||||
return FLOATNAME(LPoint3)(FLOATNAME(LVecBase3)::operator / (scalar));
|
||||
}
|
||||
|
|
@ -204,7 +204,7 @@ operator / (FLOATTYPE scalar) const {
|
|||
// existing coordinate systems; it's hard to imagine it
|
||||
// ever being different.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LPoint3) FLOATNAME(LPoint3)::
|
||||
INLINE_LINMATH FLOATNAME(LPoint3) FLOATNAME(LPoint3)::
|
||||
origin(CoordinateSystem) {
|
||||
return FLOATNAME(LPoint3)(0.0, 0.0, 0.0);
|
||||
}
|
||||
|
|
@ -216,9 +216,10 @@ origin(CoordinateSystem) {
|
|||
// displacements from the origin, wherever that maps to
|
||||
// in the given coordinate system.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LPoint3) FLOATNAME(LPoint3)::
|
||||
INLINE_LINMATH FLOATNAME(LPoint3) FLOATNAME(LPoint3)::
|
||||
rfu(FLOATTYPE right_v, FLOATTYPE fwd_v, FLOATTYPE up_v,
|
||||
CoordinateSystem cs) {
|
||||
return origin(cs) +
|
||||
FLOATNAME(LVector3)::rfu(right_v, fwd_v, up_v, cs);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,40 +15,40 @@
|
|||
////////////////////////////////////////////////////////////////////
|
||||
class EXPCL_PANDA FLOATNAME(LPoint3) : public FLOATNAME(LVecBase3) {
|
||||
PUBLISHED:
|
||||
INLINE FLOATNAME(LPoint3)();
|
||||
INLINE FLOATNAME(LPoint3)(const FLOATNAME(LVecBase3) ©);
|
||||
INLINE FLOATNAME(LPoint3) &operator = (const FLOATNAME(LVecBase3) ©);
|
||||
INLINE FLOATNAME(LPoint3) &operator = (FLOATTYPE fill_value);
|
||||
INLINE FLOATNAME(LPoint3)(FLOATTYPE fill_value);
|
||||
INLINE FLOATNAME(LPoint3)(FLOATTYPE x, FLOATTYPE y, FLOATTYPE z);
|
||||
INLINE_LINMATH FLOATNAME(LPoint3)();
|
||||
INLINE_LINMATH FLOATNAME(LPoint3)(const FLOATNAME(LVecBase3) ©);
|
||||
INLINE_LINMATH FLOATNAME(LPoint3) &operator = (const FLOATNAME(LVecBase3) ©);
|
||||
INLINE_LINMATH FLOATNAME(LPoint3) &operator = (FLOATTYPE fill_value);
|
||||
INLINE_LINMATH FLOATNAME(LPoint3)(FLOATTYPE fill_value);
|
||||
INLINE_LINMATH FLOATNAME(LPoint3)(FLOATTYPE x, FLOATTYPE y, FLOATTYPE z);
|
||||
|
||||
INLINE static const FLOATNAME(LPoint3) &zero();
|
||||
INLINE static const FLOATNAME(LPoint3) &unit_x();
|
||||
INLINE static const FLOATNAME(LPoint3) &unit_y();
|
||||
INLINE static const FLOATNAME(LPoint3) &unit_z();
|
||||
INLINE_LINMATH static const FLOATNAME(LPoint3) &zero();
|
||||
INLINE_LINMATH static const FLOATNAME(LPoint3) &unit_x();
|
||||
INLINE_LINMATH static const FLOATNAME(LPoint3) &unit_y();
|
||||
INLINE_LINMATH static const FLOATNAME(LPoint3) &unit_z();
|
||||
|
||||
INLINE FLOATNAME(LPoint3) operator - () const;
|
||||
INLINE_LINMATH FLOATNAME(LPoint3) operator - () const;
|
||||
|
||||
INLINE FLOATNAME(LVecBase3)
|
||||
INLINE_LINMATH FLOATNAME(LVecBase3)
|
||||
operator + (const FLOATNAME(LVecBase3) &other) const;
|
||||
INLINE FLOATNAME(LPoint3)
|
||||
INLINE_LINMATH FLOATNAME(LPoint3)
|
||||
operator + (const FLOATNAME(LVector3) &other) const;
|
||||
|
||||
INLINE FLOATNAME(LVecBase3)
|
||||
INLINE_LINMATH FLOATNAME(LVecBase3)
|
||||
operator - (const FLOATNAME(LVecBase3) &other) const;
|
||||
INLINE FLOATNAME(LVector3)
|
||||
INLINE_LINMATH FLOATNAME(LVector3)
|
||||
operator - (const FLOATNAME(LPoint3) &other) const;
|
||||
INLINE FLOATNAME(LPoint3)
|
||||
INLINE_LINMATH FLOATNAME(LPoint3)
|
||||
operator - (const FLOATNAME(LVector3) &other) const;
|
||||
|
||||
INLINE FLOATNAME(LPoint3) cross(const FLOATNAME(LVecBase3) &other) const;
|
||||
INLINE FLOATNAME(LPoint3) operator * (FLOATTYPE scalar) const;
|
||||
INLINE FLOATNAME(LPoint3) operator / (FLOATTYPE scalar) const;
|
||||
INLINE_LINMATH FLOATNAME(LPoint3) cross(const FLOATNAME(LVecBase3) &other) const;
|
||||
INLINE_LINMATH FLOATNAME(LPoint3) operator * (FLOATTYPE scalar) const;
|
||||
INLINE_LINMATH FLOATNAME(LPoint3) operator / (FLOATTYPE scalar) const;
|
||||
|
||||
// Some special named constructors for LPoint3.
|
||||
|
||||
INLINE static FLOATNAME(LPoint3) origin(CoordinateSystem cs = CS_default);
|
||||
INLINE static FLOATNAME(LPoint3) rfu(FLOATTYPE right,
|
||||
INLINE_LINMATH static FLOATNAME(LPoint3) origin(CoordinateSystem cs = CS_default);
|
||||
INLINE_LINMATH static FLOATNAME(LPoint3) rfu(FLOATTYPE right,
|
||||
FLOATTYPE fwd,
|
||||
FLOATTYPE up,
|
||||
CoordinateSystem cs = CS_default);
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LPoint4)::
|
||||
INLINE_LINMATH FLOATNAME(LPoint4)::
|
||||
FLOATNAME(LPoint4)() {
|
||||
}
|
||||
|
||||
|
|
@ -18,7 +18,7 @@ FLOATNAME(LPoint4)() {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LPoint4)::
|
||||
INLINE_LINMATH FLOATNAME(LPoint4)::
|
||||
FLOATNAME(LPoint4)(const FLOATNAME(LVecBase4) ©) : FLOATNAME(LVecBase4)(copy) {
|
||||
}
|
||||
|
||||
|
|
@ -27,7 +27,7 @@ FLOATNAME(LPoint4)(const FLOATNAME(LVecBase4) ©) : FLOATNAME(LVecBase4)(copy
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LPoint4) &FLOATNAME(LPoint4)::
|
||||
INLINE_LINMATH FLOATNAME(LPoint4) &FLOATNAME(LPoint4)::
|
||||
operator = (const FLOATNAME(LVecBase4) ©) {
|
||||
FLOATNAME(LVecBase4)::operator = (copy);
|
||||
return *this;
|
||||
|
|
@ -38,7 +38,7 @@ operator = (const FLOATNAME(LVecBase4) ©) {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LPoint4) &FLOATNAME(LPoint4)::
|
||||
INLINE_LINMATH FLOATNAME(LPoint4) &FLOATNAME(LPoint4)::
|
||||
operator = (FLOATTYPE fill_value) {
|
||||
FLOATNAME(LVecBase4)::operator = (fill_value);
|
||||
return *this;
|
||||
|
|
@ -49,7 +49,7 @@ operator = (FLOATTYPE fill_value) {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LPoint4)::
|
||||
INLINE_LINMATH FLOATNAME(LPoint4)::
|
||||
FLOATNAME(LPoint4)(FLOATTYPE fill_value) :
|
||||
FLOATNAME(LVecBase4)(fill_value)
|
||||
{
|
||||
|
|
@ -60,7 +60,7 @@ FLOATNAME(LPoint4)(FLOATTYPE fill_value) :
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LPoint4)::
|
||||
INLINE_LINMATH FLOATNAME(LPoint4)::
|
||||
FLOATNAME(LPoint4)(FLOATTYPE x, FLOATTYPE y, FLOATTYPE z, FLOATTYPE w) :
|
||||
FLOATNAME(LVecBase4)(x, y, z, w)
|
||||
{
|
||||
|
|
@ -71,7 +71,7 @@ FLOATNAME(LPoint4)(FLOATTYPE x, FLOATTYPE y, FLOATTYPE z, FLOATTYPE w) :
|
|||
// Access: Public
|
||||
// Description: Returns a zero-length point.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE const FLOATNAME(LPoint4) &FLOATNAME(LPoint4)::
|
||||
INLINE_LINMATH const FLOATNAME(LPoint4) &FLOATNAME(LPoint4)::
|
||||
zero() {
|
||||
return (const FLOATNAME(LPoint4) &)FLOATNAME(LVecBase4)::zero();
|
||||
}
|
||||
|
|
@ -81,7 +81,7 @@ zero() {
|
|||
// Access: Public
|
||||
// Description: Returns a unit X point.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE const FLOATNAME(LPoint4) &FLOATNAME(LPoint4)::
|
||||
INLINE_LINMATH const FLOATNAME(LPoint4) &FLOATNAME(LPoint4)::
|
||||
unit_x() {
|
||||
return (const FLOATNAME(LPoint4) &)FLOATNAME(LVecBase4)::unit_x();
|
||||
}
|
||||
|
|
@ -91,7 +91,7 @@ unit_x() {
|
|||
// Access: Public
|
||||
// Description: Returns a unit Y point.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE const FLOATNAME(LPoint4) &FLOATNAME(LPoint4)::
|
||||
INLINE_LINMATH const FLOATNAME(LPoint4) &FLOATNAME(LPoint4)::
|
||||
unit_y() {
|
||||
return (const FLOATNAME(LPoint4) &)FLOATNAME(LVecBase4)::unit_y();
|
||||
}
|
||||
|
|
@ -101,7 +101,7 @@ unit_y() {
|
|||
// Access: Public
|
||||
// Description: Returns a unit Z point.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE const FLOATNAME(LPoint4) &FLOATNAME(LPoint4)::
|
||||
INLINE_LINMATH const FLOATNAME(LPoint4) &FLOATNAME(LPoint4)::
|
||||
unit_z() {
|
||||
return (const FLOATNAME(LPoint4) &)FLOATNAME(LVecBase4)::unit_z();
|
||||
}
|
||||
|
|
@ -111,7 +111,7 @@ unit_z() {
|
|||
// Access: Public
|
||||
// Description: Returns a unit W point.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE const FLOATNAME(LPoint4) &FLOATNAME(LPoint4)::
|
||||
INLINE_LINMATH const FLOATNAME(LPoint4) &FLOATNAME(LPoint4)::
|
||||
unit_w() {
|
||||
return (const FLOATNAME(LPoint4) &)FLOATNAME(LVecBase4)::unit_w();
|
||||
}
|
||||
|
|
@ -121,7 +121,7 @@ unit_w() {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LPoint4) FLOATNAME(LPoint4)::
|
||||
INLINE_LINMATH FLOATNAME(LPoint4) FLOATNAME(LPoint4)::
|
||||
operator - () const {
|
||||
return FLOATNAME(LVecBase4)::operator - ();
|
||||
}
|
||||
|
|
@ -131,7 +131,7 @@ operator - () const {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVecBase4) FLOATNAME(LPoint4)::
|
||||
INLINE_LINMATH FLOATNAME(LVecBase4) FLOATNAME(LPoint4)::
|
||||
operator + (const FLOATNAME(LVecBase4) &other) const {
|
||||
return FLOATNAME(LVecBase4)::operator + (other);
|
||||
}
|
||||
|
|
@ -141,7 +141,7 @@ operator + (const FLOATNAME(LVecBase4) &other) const {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LPoint4) FLOATNAME(LPoint4)::
|
||||
INLINE_LINMATH FLOATNAME(LPoint4) FLOATNAME(LPoint4)::
|
||||
operator + (const FLOATNAME(LVector4) &other) const {
|
||||
return FLOATNAME(LVecBase4)::operator + (other);
|
||||
}
|
||||
|
|
@ -151,7 +151,7 @@ operator + (const FLOATNAME(LVector4) &other) const {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVecBase4) FLOATNAME(LPoint4)::
|
||||
INLINE_LINMATH FLOATNAME(LVecBase4) FLOATNAME(LPoint4)::
|
||||
operator - (const FLOATNAME(LVecBase4) &other) const {
|
||||
return FLOATNAME(LVecBase4)::operator - (other);
|
||||
}
|
||||
|
|
@ -161,7 +161,7 @@ operator - (const FLOATNAME(LVecBase4) &other) const {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVector4) FLOATNAME(LPoint4)::
|
||||
INLINE_LINMATH FLOATNAME(LVector4) FLOATNAME(LPoint4)::
|
||||
operator - (const FLOATNAME(LPoint4) &other) const {
|
||||
return FLOATNAME(LVecBase4)::operator - (other);
|
||||
}
|
||||
|
|
@ -171,7 +171,7 @@ operator - (const FLOATNAME(LPoint4) &other) const {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LPoint4) FLOATNAME(LPoint4)::
|
||||
INLINE_LINMATH FLOATNAME(LPoint4) FLOATNAME(LPoint4)::
|
||||
operator - (const FLOATNAME(LVector4) &other) const {
|
||||
return FLOATNAME(LVecBase4)::operator - (other);
|
||||
}
|
||||
|
|
@ -181,7 +181,7 @@ operator - (const FLOATNAME(LVector4) &other) const {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LPoint4) FLOATNAME(LPoint4)::
|
||||
INLINE_LINMATH FLOATNAME(LPoint4) FLOATNAME(LPoint4)::
|
||||
operator * (FLOATTYPE scalar) const {
|
||||
return FLOATNAME(LPoint4)(FLOATNAME(LVecBase4)::operator * (scalar));
|
||||
}
|
||||
|
|
@ -191,7 +191,7 @@ operator * (FLOATTYPE scalar) const {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LPoint4) FLOATNAME(LPoint4)::
|
||||
INLINE_LINMATH FLOATNAME(LPoint4) FLOATNAME(LPoint4)::
|
||||
operator / (FLOATTYPE scalar) const {
|
||||
return FLOATNAME(LPoint4)(FLOATNAME(LVecBase4)::operator / (scalar));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,35 +9,35 @@
|
|||
////////////////////////////////////////////////////////////////////
|
||||
class EXPCL_PANDA FLOATNAME(LPoint4) : public FLOATNAME(LVecBase4) {
|
||||
PUBLISHED:
|
||||
INLINE FLOATNAME(LPoint4)();
|
||||
INLINE FLOATNAME(LPoint4)(const FLOATNAME(LVecBase4) ©);
|
||||
INLINE FLOATNAME(LPoint4) &operator = (const FLOATNAME(LVecBase4) ©);
|
||||
INLINE FLOATNAME(LPoint4) &operator = (FLOATTYPE fill_value);
|
||||
INLINE FLOATNAME(LPoint4)(FLOATTYPE fill_value);
|
||||
INLINE FLOATNAME(LPoint4)(FLOATTYPE x, FLOATTYPE y, FLOATTYPE z, FLOATTYPE w);
|
||||
INLINE_LINMATH FLOATNAME(LPoint4)();
|
||||
INLINE_LINMATH FLOATNAME(LPoint4)(const FLOATNAME(LVecBase4) ©);
|
||||
INLINE_LINMATH FLOATNAME(LPoint4) &operator = (const FLOATNAME(LVecBase4) ©);
|
||||
INLINE_LINMATH FLOATNAME(LPoint4) &operator = (FLOATTYPE fill_value);
|
||||
INLINE_LINMATH FLOATNAME(LPoint4)(FLOATTYPE fill_value);
|
||||
INLINE_LINMATH FLOATNAME(LPoint4)(FLOATTYPE x, FLOATTYPE y, FLOATTYPE z, FLOATTYPE w);
|
||||
|
||||
INLINE static const FLOATNAME(LPoint4) &zero();
|
||||
INLINE static const FLOATNAME(LPoint4) &unit_x();
|
||||
INLINE static const FLOATNAME(LPoint4) &unit_y();
|
||||
INLINE static const FLOATNAME(LPoint4) &unit_z();
|
||||
INLINE static const FLOATNAME(LPoint4) &unit_w();
|
||||
INLINE_LINMATH static const FLOATNAME(LPoint4) &zero();
|
||||
INLINE_LINMATH static const FLOATNAME(LPoint4) &unit_x();
|
||||
INLINE_LINMATH static const FLOATNAME(LPoint4) &unit_y();
|
||||
INLINE_LINMATH static const FLOATNAME(LPoint4) &unit_z();
|
||||
INLINE_LINMATH static const FLOATNAME(LPoint4) &unit_w();
|
||||
|
||||
INLINE FLOATNAME(LPoint4) operator - () const;
|
||||
INLINE_LINMATH FLOATNAME(LPoint4) operator - () const;
|
||||
|
||||
INLINE FLOATNAME(LVecBase4)
|
||||
INLINE_LINMATH FLOATNAME(LVecBase4)
|
||||
operator + (const FLOATNAME(LVecBase4) &other) const;
|
||||
INLINE FLOATNAME(LPoint4)
|
||||
INLINE_LINMATH FLOATNAME(LPoint4)
|
||||
operator + (const FLOATNAME(LVector4) &other) const;
|
||||
|
||||
INLINE FLOATNAME(LVecBase4)
|
||||
INLINE_LINMATH FLOATNAME(LVecBase4)
|
||||
operator - (const FLOATNAME(LVecBase4) &other) const;
|
||||
INLINE FLOATNAME(LVector4)
|
||||
INLINE_LINMATH FLOATNAME(LVector4)
|
||||
operator - (const FLOATNAME(LPoint4) &other) const;
|
||||
INLINE FLOATNAME(LPoint4)
|
||||
INLINE_LINMATH FLOATNAME(LPoint4)
|
||||
operator - (const FLOATNAME(LVector4) &other) const;
|
||||
|
||||
INLINE FLOATNAME(LPoint4) operator * (FLOATTYPE scalar) const;
|
||||
INLINE FLOATNAME(LPoint4) operator / (FLOATTYPE scalar) const;
|
||||
INLINE_LINMATH FLOATNAME(LPoint4) operator * (FLOATTYPE scalar) const;
|
||||
INLINE_LINMATH FLOATNAME(LPoint4) operator / (FLOATTYPE scalar) const;
|
||||
|
||||
public:
|
||||
static TypeHandle get_class_type() {
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
// Access: public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LQuaternion)::
|
||||
INLINE_LINMATH FLOATNAME(LQuaternion)::
|
||||
FLOATNAME(LQuaternion)() {
|
||||
}
|
||||
|
||||
|
|
@ -17,7 +17,7 @@ FLOATNAME(LQuaternion)() {
|
|||
// Access: public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LQuaternion)::
|
||||
INLINE_LINMATH FLOATNAME(LQuaternion)::
|
||||
FLOATNAME(LQuaternion)(const FLOATNAME(LQuaternion) &c) :
|
||||
FLOATNAME(LVecBase4)(c)
|
||||
{
|
||||
|
|
@ -28,7 +28,7 @@ FLOATNAME(LQuaternion)(const FLOATNAME(LQuaternion) &c) :
|
|||
// Access: public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LQuaternion)::
|
||||
INLINE_LINMATH FLOATNAME(LQuaternion)::
|
||||
FLOATNAME(LQuaternion)(FLOATTYPE r, FLOATTYPE i, FLOATTYPE j, FLOATTYPE k) {
|
||||
set(r, i, j, k);
|
||||
}
|
||||
|
|
@ -38,12 +38,12 @@ FLOATNAME(LQuaternion)(FLOATTYPE r, FLOATTYPE i, FLOATTYPE j, FLOATTYPE k) {
|
|||
// Access: protected
|
||||
// Description: actual multiply call (non virtual)
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LQuaternion) FLOATNAME(LQuaternion)::
|
||||
INLINE_LINMATH FLOATNAME(LQuaternion) FLOATNAME(LQuaternion)::
|
||||
multiply(const FLOATNAME(LQuaternion)& rhs) const {
|
||||
FLOATTYPE r = (_data[0] * rhs._data[0]) - (_data[1] * rhs._data[1]) - (_data[2] * rhs._data[2]) - (_data[3] * rhs._data[3]);
|
||||
FLOATTYPE i = (_data[1] * rhs._data[0]) + (_data[0] * rhs._data[1]) - (_data[3] * rhs._data[2]) + (_data[2] * rhs._data[3]);
|
||||
FLOATTYPE j = (_data[2] * rhs._data[0]) + (_data[3] * rhs._data[1]) + (_data[0] * rhs._data[2]) - (_data[1] * rhs._data[3]);
|
||||
FLOATTYPE k = (_data[3] * rhs._data[0]) - (_data[2] * rhs._data[1]) + (_data[1] * rhs._data[2]) + (_data[0] * rhs._data[3]);
|
||||
FLOATTYPE r = (_v.data[0] * rhs._v.data[0]) - (_v.data[1] * rhs._v.data[1]) - (_v.data[2] * rhs._v.data[2]) - (_v.data[3] * rhs._v.data[3]);
|
||||
FLOATTYPE i = (_v.data[1] * rhs._v.data[0]) + (_v.data[0] * rhs._v.data[1]) - (_v.data[3] * rhs._v.data[2]) + (_v.data[2] * rhs._v.data[3]);
|
||||
FLOATTYPE j = (_v.data[2] * rhs._v.data[0]) + (_v.data[3] * rhs._v.data[1]) + (_v.data[0] * rhs._v.data[2]) - (_v.data[1] * rhs._v.data[3]);
|
||||
FLOATTYPE k = (_v.data[3] * rhs._v.data[0]) - (_v.data[2] * rhs._v.data[1]) + (_v.data[1] * rhs._v.data[2]) + (_v.data[0] * rhs._v.data[3]);
|
||||
|
||||
return FLOATNAME(LQuaternion)(r, i , j, k);
|
||||
}
|
||||
|
|
@ -53,7 +53,7 @@ multiply(const FLOATNAME(LQuaternion)& rhs) const {
|
|||
// Access: public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LQuaternion) FLOATNAME(LQuaternion)::
|
||||
INLINE_LINMATH FLOATNAME(LQuaternion) FLOATNAME(LQuaternion)::
|
||||
operator *(const FLOATNAME(LQuaternion)& c) {
|
||||
return multiply(c);
|
||||
}
|
||||
|
|
@ -63,7 +63,7 @@ operator *(const FLOATNAME(LQuaternion)& c) {
|
|||
// Access: public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LQuaternion)& FLOATNAME(LQuaternion)::
|
||||
INLINE_LINMATH FLOATNAME(LQuaternion)& FLOATNAME(LQuaternion)::
|
||||
operator *=(const FLOATNAME(LQuaternion)& c) {
|
||||
(*this) = operator*(c);
|
||||
return *this;
|
||||
|
|
@ -74,7 +74,7 @@ operator *=(const FLOATNAME(LQuaternion)& c) {
|
|||
// Access: public
|
||||
// Description: Quat * Matrix = matrix
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LMatrix3) FLOATNAME(LQuaternion)::
|
||||
INLINE_LINMATH FLOATNAME(LMatrix3) FLOATNAME(LQuaternion)::
|
||||
operator *(const FLOATNAME(LMatrix3) &m) {
|
||||
FLOATNAME(LMatrix3) result;
|
||||
extract_to_matrix(result);
|
||||
|
|
@ -86,7 +86,7 @@ operator *(const FLOATNAME(LMatrix3) &m) {
|
|||
// Access: public
|
||||
// Description: Quat * Matrix = matrix
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LMatrix4) FLOATNAME(LQuaternion)::
|
||||
INLINE_LINMATH FLOATNAME(LMatrix4) FLOATNAME(LQuaternion)::
|
||||
operator *(const FLOATNAME(LMatrix4) &m) {
|
||||
FLOATNAME(LMatrix3) m_upper_3 = m.get_upper_3();
|
||||
FLOATNAME(LMatrix3) this_quat;
|
||||
|
|
@ -106,12 +106,12 @@ operator *(const FLOATNAME(LMatrix4) &m) {
|
|||
// Description: Returns true if two quaternions are memberwise equal
|
||||
// within a specified tolerance.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE bool FLOATNAME(LQuaternion)::
|
||||
INLINE_LINMATH bool FLOATNAME(LQuaternion)::
|
||||
almost_equal(const FLOATNAME(LQuaternion)& c, FLOATTYPE threshold) const {
|
||||
return (IS_THRESHOLD_EQUAL(_data[0], c._data[0], threshold) &&
|
||||
IS_THRESHOLD_EQUAL(_data[1], c._data[1], threshold) &&
|
||||
IS_THRESHOLD_EQUAL(_data[2], c._data[2], threshold) &&
|
||||
IS_THRESHOLD_EQUAL(_data[3], c._data[3], threshold));
|
||||
return (IS_THRESHOLD_EQUAL(_v.data[0], c._v.data[0], threshold) &&
|
||||
IS_THRESHOLD_EQUAL(_v.data[1], c._v.data[1], threshold) &&
|
||||
IS_THRESHOLD_EQUAL(_v.data[2], c._v.data[2], threshold) &&
|
||||
IS_THRESHOLD_EQUAL(_v.data[3], c._v.data[3], threshold));
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -120,7 +120,7 @@ almost_equal(const FLOATNAME(LQuaternion)& c, FLOATTYPE threshold) const {
|
|||
// Description: Returns true if two quaternions are memberwise equal
|
||||
// within a default tolerance based on the numeric type.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE bool FLOATNAME(LQuaternion)::
|
||||
INLINE_LINMATH bool FLOATNAME(LQuaternion)::
|
||||
almost_equal(const FLOATNAME(LQuaternion)& c) const {
|
||||
return almost_equal(c, NEARLY_ZERO(FLOATTYPE));
|
||||
}
|
||||
|
|
@ -130,12 +130,12 @@ almost_equal(const FLOATNAME(LQuaternion)& c) const {
|
|||
// Access: public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void FLOATNAME(LQuaternion)::
|
||||
INLINE_LINMATH void FLOATNAME(LQuaternion)::
|
||||
output(ostream& os) const {
|
||||
os << MAYBE_ZERO(_data[0]) << " + "
|
||||
<< MAYBE_ZERO(_data[1]) << "i + "
|
||||
<< MAYBE_ZERO(_data[2]) << "j + "
|
||||
<< MAYBE_ZERO(_data[3]) << "k";
|
||||
os << MAYBE_ZERO(_v.data[0]) << " + "
|
||||
<< MAYBE_ZERO(_v.data[1]) << "i + "
|
||||
<< MAYBE_ZERO(_v.data[2]) << "j + "
|
||||
<< MAYBE_ZERO(_v.data[3]) << "k";
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -143,9 +143,9 @@ output(ostream& os) const {
|
|||
// Access: public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATTYPE FLOATNAME(LQuaternion)::
|
||||
INLINE_LINMATH FLOATTYPE FLOATNAME(LQuaternion)::
|
||||
get_r() const {
|
||||
return _data[0];
|
||||
return _v.data[0];
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -153,9 +153,9 @@ get_r() const {
|
|||
// Access: public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATTYPE FLOATNAME(LQuaternion)::
|
||||
INLINE_LINMATH FLOATTYPE FLOATNAME(LQuaternion)::
|
||||
get_i() const {
|
||||
return _data[1];
|
||||
return _v.data[1];
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -163,9 +163,9 @@ get_i() const {
|
|||
// Access: public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATTYPE FLOATNAME(LQuaternion)::
|
||||
INLINE_LINMATH FLOATTYPE FLOATNAME(LQuaternion)::
|
||||
get_j() const {
|
||||
return _data[2];
|
||||
return _v.data[2];
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -173,9 +173,9 @@ get_j() const {
|
|||
// Access: public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATTYPE FLOATNAME(LQuaternion)::
|
||||
INLINE_LINMATH FLOATTYPE FLOATNAME(LQuaternion)::
|
||||
get_k() const {
|
||||
return _data[3];
|
||||
return _v.data[3];
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -183,9 +183,9 @@ get_k() const {
|
|||
// Access: public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void FLOATNAME(LQuaternion)::
|
||||
INLINE_LINMATH void FLOATNAME(LQuaternion)::
|
||||
set_r(FLOATTYPE r) {
|
||||
_data[0] = r;
|
||||
_v.data[0] = r;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -193,9 +193,9 @@ set_r(FLOATTYPE r) {
|
|||
// Access: public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void FLOATNAME(LQuaternion)::
|
||||
INLINE_LINMATH void FLOATNAME(LQuaternion)::
|
||||
set_i(FLOATTYPE i) {
|
||||
_data[1] = i;
|
||||
_v.data[1] = i;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -203,9 +203,9 @@ set_i(FLOATTYPE i) {
|
|||
// Access: public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void FLOATNAME(LQuaternion)::
|
||||
INLINE_LINMATH void FLOATNAME(LQuaternion)::
|
||||
set_j(FLOATTYPE j) {
|
||||
_data[2] = j;
|
||||
_v.data[2] = j;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -213,9 +213,9 @@ set_j(FLOATTYPE j) {
|
|||
// Access: public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void FLOATNAME(LQuaternion)::
|
||||
INLINE_LINMATH void FLOATNAME(LQuaternion)::
|
||||
set_k(FLOATTYPE k) {
|
||||
_data[3] = k;
|
||||
_v.data[3] = k;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -223,7 +223,7 @@ set_k(FLOATTYPE k) {
|
|||
// Access: public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE bool FLOATNAME(LQuaternion)::
|
||||
INLINE_LINMATH bool FLOATNAME(LQuaternion)::
|
||||
normalize() {
|
||||
FLOATTYPE l2 = (*this).dot(*this);
|
||||
if (l2 == (FLOATTYPE)0.0) {
|
||||
|
|
@ -242,7 +242,7 @@ normalize() {
|
|||
// Access: public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void FLOATNAME(LQuaternion)::
|
||||
INLINE_LINMATH void FLOATNAME(LQuaternion)::
|
||||
set_from_matrix(const FLOATNAME(LMatrix4) &m) {
|
||||
set_from_matrix(m.get_upper_3());
|
||||
}
|
||||
|
|
@ -252,7 +252,7 @@ set_from_matrix(const FLOATNAME(LMatrix4) &m) {
|
|||
// Access: public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LMatrix3) operator *(const FLOATNAME(LMatrix3) &m,
|
||||
INLINE_LINMATH FLOATNAME(LMatrix3) operator *(const FLOATNAME(LMatrix3) &m,
|
||||
const FLOATNAME(LQuaternion) &q) {
|
||||
FLOATNAME(LMatrix3) q_matrix;
|
||||
q.extract_to_matrix(q_matrix);
|
||||
|
|
@ -265,7 +265,7 @@ INLINE FLOATNAME(LMatrix3) operator *(const FLOATNAME(LMatrix3) &m,
|
|||
// Access: public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LMatrix4) operator *(const FLOATNAME(LMatrix4) &m,
|
||||
INLINE_LINMATH FLOATNAME(LMatrix4) operator *(const FLOATNAME(LMatrix4) &m,
|
||||
const FLOATNAME(LQuaternion) &q) {
|
||||
FLOATNAME(LMatrix4) q_matrix;
|
||||
q.extract_to_matrix(q_matrix);
|
||||
|
|
@ -287,7 +287,7 @@ INLINE FLOATNAME(LMatrix4) operator *(const FLOATNAME(LMatrix4) &m,
|
|||
// Access: Public, Static
|
||||
// Description: Returns an identity quaternion.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE const FLOATNAME(LQuaternion) &FLOATNAME(LQuaternion)::
|
||||
INLINE_LINMATH const FLOATNAME(LQuaternion) &FLOATNAME(LQuaternion)::
|
||||
ident_quat() {
|
||||
return _ident_quat;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,14 +21,14 @@ pure_imaginary(const FLOATNAME(LVector3) &v) {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
void FLOATNAME(LQuaternion)::
|
||||
extract_to_matrix(FLOATNAME(LMatrix3) &m) const {
|
||||
FLOATTYPE N = (_data[0] * _data[0]) + (_data[1] * _data[1]) + (_data[2] * _data[2]) + (_data[3] * _data[3]);
|
||||
FLOATTYPE N = (_v.data[0] * _v.data[0]) + (_v.data[1] * _v.data[1]) + (_v.data[2] * _v.data[2]) + (_v.data[3] * _v.data[3]);
|
||||
FLOATTYPE s = (N == 0.) ? 0. : (2. / N);
|
||||
FLOATTYPE xs, ys, zs, wx, wy, wz, xx, xy, xz, yy, yz, zz;
|
||||
|
||||
xs = _data[1] * s; ys = _data[2] * s; zs = _data[3] * s;
|
||||
wx = _data[0] * xs; wy = _data[0] * ys; wz = _data[0] * zs;
|
||||
xx = _data[1] * xs; xy = _data[1] * ys; xz = _data[1] * zs;
|
||||
yy = _data[2] * ys; yz = _data[2] * zs; zz = _data[3] * zs;
|
||||
xs = _v.data[1] * s; ys = _v.data[2] * s; zs = _v.data[3] * s;
|
||||
wx = _v.data[0] * xs; wy = _v.data[0] * ys; wz = _v.data[0] * zs;
|
||||
xx = _v.data[1] * xs; xy = _v.data[1] * ys; xz = _v.data[1] * zs;
|
||||
yy = _v.data[2] * ys; yz = _v.data[2] * zs; zz = _v.data[3] * zs;
|
||||
|
||||
m = FLOATNAME(LMatrix3)((1. - (yy + zz)), (xy - wz), (xz + wy),
|
||||
(xy + wz), (1. - (xx + zz)), (yz - wx),
|
||||
|
|
@ -42,14 +42,14 @@ extract_to_matrix(FLOATNAME(LMatrix3) &m) const {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
void FLOATNAME(LQuaternion)::
|
||||
extract_to_matrix(FLOATNAME(LMatrix4) &m) const {
|
||||
FLOATTYPE N = (_data[0] * _data[0]) + (_data[1] * _data[1]) + (_data[2] * _data[2]) + (_data[3] * _data[3]);
|
||||
FLOATTYPE N = (_v.data[0] * _v.data[0]) + (_v.data[1] * _v.data[1]) + (_v.data[2] * _v.data[2]) + (_v.data[3] * _v.data[3]);
|
||||
FLOATTYPE s = (N == 0.) ? 0. : (2. / N);
|
||||
FLOATTYPE xs, ys, zs, wx, wy, wz, xx, xy, xz, yy, yz, zz;
|
||||
|
||||
xs = _data[1] * s; ys = _data[2] * s; zs = _data[3] * s;
|
||||
wx = _data[0] * xs; wy = _data[0] * ys; wz = _data[0] * zs;
|
||||
xx = _data[1] * xs; xy = _data[1] * ys; xz = _data[1] * zs;
|
||||
yy = _data[2] * ys; yz = _data[2] * zs; zz = _data[3] * zs;
|
||||
xs = _v.data[1] * s; ys = _v.data[2] * s; zs = _v.data[3] * s;
|
||||
wx = _v.data[0] * xs; wy = _v.data[0] * ys; wz = _v.data[0] * zs;
|
||||
xx = _v.data[1] * xs; xy = _v.data[1] * ys; xz = _v.data[1] * zs;
|
||||
yy = _v.data[2] * ys; yz = _v.data[2] * zs; zz = _v.data[3] * zs;
|
||||
|
||||
m = FLOATNAME(LMatrix4)((1. - (yy + zz)), (xy - wz), (xz + wy), 0.,
|
||||
(xy + wz), (1. - (xx + zz)), (yz - wx), 0.,
|
||||
|
|
@ -96,15 +96,15 @@ set_hpr(const FLOATNAME(LVecBase3) &hpr) {
|
|||
FLOATNAME(LVecBase3) FLOATNAME(LQuaternion)::
|
||||
get_hpr() const {
|
||||
FLOATTYPE heading, pitch, roll;
|
||||
FLOATTYPE N = (_data[0] * _data[0]) + (_data[1] * _data[1]) + (_data[2] * _data[2]) + (_data[3] * _data[3]);
|
||||
FLOATTYPE N = (_v.data[0] * _v.data[0]) + (_v.data[1] * _v.data[1]) + (_v.data[2] * _v.data[2]) + (_v.data[3] * _v.data[3]);
|
||||
FLOATTYPE s = (N == 0.) ? 0. : (2. / N);
|
||||
FLOATTYPE xs, ys, zs, wx, wy, wz, xx, xy, xz, yy, yz, zz, c1, c2, c3, c4;
|
||||
FLOATTYPE cr, sr, cp, sp, ch, sh;
|
||||
|
||||
xs = _data[1] * s; ys = _data[2] * s; zs = _data[3] * s;
|
||||
wx = _data[0] * xs; wy = _data[0] * ys; wz = _data[0] * zs;
|
||||
xx = _data[1] * xs; xy = _data[1] * ys; xz = _data[1] * zs;
|
||||
yy = _data[2] * ys; yz = _data[2] * zs; zz = _data[3] * zs;
|
||||
xs = _v.data[1] * s; ys = _v.data[2] * s; zs = _v.data[3] * s;
|
||||
wx = _v.data[0] * xs; wy = _v.data[0] * ys; wz = _v.data[0] * zs;
|
||||
xx = _v.data[1] * xs; xy = _v.data[1] * ys; xz = _v.data[1] * zs;
|
||||
yy = _v.data[2] * ys; yz = _v.data[2] * zs; zz = _v.data[3] * zs;
|
||||
c1 = xz - wy;
|
||||
c2 = 1. - (xx + yy);
|
||||
c3 = 1. - (yy + zz);
|
||||
|
|
@ -160,10 +160,10 @@ set_from_matrix(const FLOATNAME(LMatrix3) &m) {
|
|||
if (T > 0.) {
|
||||
// the easy case
|
||||
FLOATTYPE S = 0.5 / csqrt(T);
|
||||
_data[0] = 0.25 / S;
|
||||
_data[1] = (m21 - m12) * S;
|
||||
_data[2] = (m02 - m20) * S;
|
||||
_data[3] = (m10 - m01) * S;
|
||||
_v.data[0] = 0.25 / S;
|
||||
_v.data[1] = (m21 - m12) * S;
|
||||
_v.data[2] = (m02 - m20) * S;
|
||||
_v.data[3] = (m10 - m01) * S;
|
||||
} else {
|
||||
// figure out which column to take as root
|
||||
int c = 0;
|
||||
|
|
@ -182,24 +182,24 @@ set_from_matrix(const FLOATNAME(LMatrix3) &m) {
|
|||
switch (c) {
|
||||
case 0:
|
||||
S = csqrt(1. + m00 - m11 - m22) * 2.;
|
||||
_data[0] = (m12 + m21) / S;
|
||||
_data[1] = 0.5 / S;
|
||||
_data[2] = (m01 + m10) / S;
|
||||
_data[3] = (m02 + m20) / S;
|
||||
_v.data[0] = (m12 + m21) / S;
|
||||
_v.data[1] = 0.5 / S;
|
||||
_v.data[2] = (m01 + m10) / S;
|
||||
_v.data[3] = (m02 + m20) / S;
|
||||
break;
|
||||
case 1:
|
||||
S = csqrt(1. + m11 - m00 - m22) * 2.;
|
||||
_data[0] = (m02 + m20) / S;
|
||||
_data[1] = (m01 + m10) / S;
|
||||
_data[2] = 0.5 / S;
|
||||
_data[3] = (m12 + m21) / S;
|
||||
_v.data[0] = (m02 + m20) / S;
|
||||
_v.data[1] = (m01 + m10) / S;
|
||||
_v.data[2] = 0.5 / S;
|
||||
_v.data[3] = (m12 + m21) / S;
|
||||
break;
|
||||
case 2:
|
||||
S = csqrt(1. + m22 - m00 - m11) * 2.;
|
||||
_data[0] = (m01 + m10) / S;
|
||||
_data[1] = (m02 + m20) / S;
|
||||
_data[2] = (m12 + m21) / S;
|
||||
_data[3] = 0.5 / S;
|
||||
_v.data[0] = (m01 + m10) / S;
|
||||
_v.data[1] = (m02 + m20) / S;
|
||||
_v.data[2] = (m12 + m21) / S;
|
||||
_v.data[3] = 0.5 / S;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,48 +9,48 @@
|
|||
////////////////////////////////////////////////////////////////////
|
||||
class EXPCL_PANDA FLOATNAME(LQuaternion) : public FLOATNAME(LVecBase4) {
|
||||
protected:
|
||||
INLINE FLOATNAME(LQuaternion)
|
||||
INLINE_LINMATH FLOATNAME(LQuaternion)
|
||||
multiply(const FLOATNAME(LQuaternion)&) const;
|
||||
|
||||
PUBLISHED:
|
||||
INLINE FLOATNAME(LQuaternion)();
|
||||
INLINE FLOATNAME(LQuaternion)(const FLOATNAME(LQuaternion) &);
|
||||
INLINE FLOATNAME(LQuaternion)(FLOATTYPE, FLOATTYPE, FLOATTYPE, FLOATTYPE);
|
||||
INLINE_LINMATH FLOATNAME(LQuaternion)();
|
||||
INLINE_LINMATH FLOATNAME(LQuaternion)(const FLOATNAME(LQuaternion) &);
|
||||
INLINE_LINMATH FLOATNAME(LQuaternion)(FLOATTYPE, FLOATTYPE, FLOATTYPE, FLOATTYPE);
|
||||
|
||||
static FLOATNAME(LQuaternion) pure_imaginary(const FLOATNAME(LVector3) &);
|
||||
|
||||
INLINE FLOATNAME(LQuaternion) operator *(const FLOATNAME(LQuaternion) &);
|
||||
INLINE FLOATNAME(LQuaternion)& operator *=(const FLOATNAME(LQuaternion) &);
|
||||
INLINE_LINMATH FLOATNAME(LQuaternion) operator *(const FLOATNAME(LQuaternion) &);
|
||||
INLINE_LINMATH FLOATNAME(LQuaternion)& operator *=(const FLOATNAME(LQuaternion) &);
|
||||
|
||||
INLINE FLOATNAME(LMatrix3) operator *(const FLOATNAME(LMatrix3) &);
|
||||
INLINE FLOATNAME(LMatrix4) operator *(const FLOATNAME(LMatrix4) &);
|
||||
INLINE_LINMATH FLOATNAME(LMatrix3) operator *(const FLOATNAME(LMatrix3) &);
|
||||
INLINE_LINMATH FLOATNAME(LMatrix4) operator *(const FLOATNAME(LMatrix4) &);
|
||||
|
||||
INLINE bool almost_equal(const FLOATNAME(LQuaternion) &, FLOATTYPE) const;
|
||||
INLINE bool almost_equal(const FLOATNAME(LQuaternion) &) const;
|
||||
INLINE_LINMATH bool almost_equal(const FLOATNAME(LQuaternion) &, FLOATTYPE) const;
|
||||
INLINE_LINMATH bool almost_equal(const FLOATNAME(LQuaternion) &) const;
|
||||
|
||||
INLINE void output(ostream&) const;
|
||||
INLINE_LINMATH void output(ostream&) const;
|
||||
|
||||
void extract_to_matrix(FLOATNAME(LMatrix3) &m) const;
|
||||
void extract_to_matrix(FLOATNAME(LMatrix4) &m) const;
|
||||
|
||||
void set_from_matrix(const FLOATNAME(LMatrix3) &m);
|
||||
INLINE void set_from_matrix(const FLOATNAME(LMatrix4) &m);
|
||||
INLINE_LINMATH void set_from_matrix(const FLOATNAME(LMatrix4) &m);
|
||||
void set_hpr(const FLOATNAME(LVecBase3) &hpr);
|
||||
FLOATNAME(LVecBase3) get_hpr() const;
|
||||
|
||||
INLINE FLOATTYPE get_r() const;
|
||||
INLINE FLOATTYPE get_i() const;
|
||||
INLINE FLOATTYPE get_j() const;
|
||||
INLINE FLOATTYPE get_k() const;
|
||||
INLINE_LINMATH FLOATTYPE get_r() const;
|
||||
INLINE_LINMATH FLOATTYPE get_i() const;
|
||||
INLINE_LINMATH FLOATTYPE get_j() const;
|
||||
INLINE_LINMATH FLOATTYPE get_k() const;
|
||||
|
||||
INLINE void set_r(FLOATTYPE r);
|
||||
INLINE void set_i(FLOATTYPE i);
|
||||
INLINE void set_j(FLOATTYPE j);
|
||||
INLINE void set_k(FLOATTYPE k);
|
||||
INLINE_LINMATH void set_r(FLOATTYPE r);
|
||||
INLINE_LINMATH void set_i(FLOATTYPE i);
|
||||
INLINE_LINMATH void set_j(FLOATTYPE j);
|
||||
INLINE_LINMATH void set_k(FLOATTYPE k);
|
||||
|
||||
INLINE bool normalize();
|
||||
INLINE_LINMATH bool normalize();
|
||||
|
||||
INLINE static const FLOATNAME(LQuaternion) &ident_quat();
|
||||
INLINE_LINMATH static const FLOATNAME(LQuaternion) &ident_quat();
|
||||
|
||||
private:
|
||||
static const FLOATNAME(LQuaternion) _ident_quat;
|
||||
|
|
@ -65,15 +65,15 @@ private:
|
|||
};
|
||||
|
||||
|
||||
INLINE ostream& operator<<(ostream& os, const FLOATNAME(LQuaternion)& q) {
|
||||
INLINE_LINMATH ostream& operator<<(ostream& os, const FLOATNAME(LQuaternion)& q) {
|
||||
q.output(os);
|
||||
return os;
|
||||
}
|
||||
|
||||
BEGIN_PUBLISH
|
||||
INLINE FLOATNAME(LMatrix3)
|
||||
INLINE_LINMATH FLOATNAME(LMatrix3)
|
||||
operator * (const FLOATNAME(LMatrix3) &m, const FLOATNAME(LQuaternion) &q);
|
||||
INLINE FLOATNAME(LMatrix4)
|
||||
INLINE_LINMATH FLOATNAME(LMatrix4)
|
||||
operator * (const FLOATNAME(LMatrix4) &m, const FLOATNAME(LQuaternion) &q);
|
||||
END_PUBLISH
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
// Access: public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LRotation)::
|
||||
INLINE_LINMATH FLOATNAME(LRotation)::
|
||||
FLOATNAME(LRotation)() {
|
||||
}
|
||||
|
||||
|
|
@ -17,7 +17,7 @@ FLOATNAME(LRotation)() {
|
|||
// Access: public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LRotation)::
|
||||
INLINE_LINMATH FLOATNAME(LRotation)::
|
||||
FLOATNAME(LRotation)(const FLOATNAME(LQuaternion)& c) :
|
||||
FLOATNAME(LQuaternion)(c) {
|
||||
}
|
||||
|
|
@ -27,7 +27,7 @@ FLOATNAME(LRotation)(const FLOATNAME(LQuaternion)& c) :
|
|||
// Access: public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LRotation)::
|
||||
INLINE_LINMATH FLOATNAME(LRotation)::
|
||||
FLOATNAME(LRotation)(FLOATTYPE r, FLOATTYPE i, FLOATTYPE j, FLOATTYPE k) :
|
||||
FLOATNAME(LQuaternion)(r, i, j, k) {
|
||||
}
|
||||
|
|
@ -37,7 +37,7 @@ FLOATNAME(LRotation)(FLOATTYPE r, FLOATTYPE i, FLOATTYPE j, FLOATTYPE k) :
|
|||
// Access: public
|
||||
// Description: lmatrix3
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LRotation)::
|
||||
INLINE_LINMATH FLOATNAME(LRotation)::
|
||||
FLOATNAME(LRotation)(const FLOATNAME(LMatrix3) &m) {
|
||||
set_from_matrix(m);
|
||||
}
|
||||
|
|
@ -47,7 +47,7 @@ FLOATNAME(LRotation)(const FLOATNAME(LMatrix3) &m) {
|
|||
// Access: public
|
||||
// Description: lmatrix4
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LRotation)::
|
||||
INLINE_LINMATH FLOATNAME(LRotation)::
|
||||
FLOATNAME(LRotation)(const FLOATNAME(LMatrix4) &m) {
|
||||
set_from_matrix(m);
|
||||
}
|
||||
|
|
@ -57,7 +57,7 @@ FLOATNAME(LRotation)(const FLOATNAME(LMatrix4) &m) {
|
|||
// Access: public
|
||||
// Description: axis + angle (in degrees)
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LRotation)::
|
||||
INLINE_LINMATH FLOATNAME(LRotation)::
|
||||
FLOATNAME(LRotation)(const FLOATNAME(LVector3) &axis, FLOATTYPE angle) {
|
||||
FLOATTYPE radians = angle * ((FLOATTYPE) MathNumbers::pi / (FLOATTYPE)180.0);
|
||||
FLOATTYPE theta_over_2 = radians / (FLOATTYPE)2.0;
|
||||
|
|
@ -74,7 +74,7 @@ FLOATNAME(LRotation)(const FLOATNAME(LVector3) &axis, FLOATTYPE angle) {
|
|||
// Access: public
|
||||
// Description: Sets the rotation from the given Euler angles.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LRotation)::
|
||||
INLINE_LINMATH FLOATNAME(LRotation)::
|
||||
FLOATNAME(LRotation)(FLOATTYPE h, FLOATTYPE p, FLOATTYPE r) {
|
||||
set_hpr(FLOATNAME(LVecBase3)(h, p, r));
|
||||
}
|
||||
|
|
@ -84,7 +84,7 @@ FLOATNAME(LRotation)(FLOATTYPE h, FLOATTYPE p, FLOATTYPE r) {
|
|||
// Access: public
|
||||
// Description: Rotation * Rotation = Rotation
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LRotation) FLOATNAME(LRotation)::
|
||||
INLINE_LINMATH FLOATNAME(LRotation) FLOATNAME(LRotation)::
|
||||
operator*(const FLOATNAME(LRotation)& other) const {
|
||||
return multiply(other);
|
||||
}
|
||||
|
|
@ -97,7 +97,7 @@ operator*(const FLOATNAME(LRotation)& other) const {
|
|||
// to apply an orientation to a rotation. It simply
|
||||
// returns the rhs.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LQuaternion) FLOATNAME(LRotation)::
|
||||
INLINE_LINMATH FLOATNAME(LQuaternion) FLOATNAME(LRotation)::
|
||||
operator*(const FLOATNAME(LQuaternion)& other) const {
|
||||
return other;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,18 +9,18 @@
|
|||
////////////////////////////////////////////////////////////////////////
|
||||
class EXPCL_PANDA FLOATNAME(LRotation) : public FLOATNAME(LQuaternion) {
|
||||
PUBLISHED:
|
||||
INLINE FLOATNAME(LRotation)();
|
||||
INLINE FLOATNAME(LRotation)(const FLOATNAME(LQuaternion)&);
|
||||
INLINE FLOATNAME(LRotation)(FLOATTYPE, FLOATTYPE, FLOATTYPE, FLOATTYPE);
|
||||
INLINE FLOATNAME(LRotation)(const FLOATNAME(LVector3) &, FLOATTYPE);
|
||||
INLINE FLOATNAME(LRotation)(const FLOATNAME(LMatrix3) &);
|
||||
INLINE FLOATNAME(LRotation)(const FLOATNAME(LMatrix4) &);
|
||||
INLINE FLOATNAME(LRotation)(FLOATTYPE, FLOATTYPE, FLOATTYPE);
|
||||
INLINE_LINMATH FLOATNAME(LRotation)();
|
||||
INLINE_LINMATH FLOATNAME(LRotation)(const FLOATNAME(LQuaternion)&);
|
||||
INLINE_LINMATH FLOATNAME(LRotation)(FLOATTYPE, FLOATTYPE, FLOATTYPE, FLOATTYPE);
|
||||
INLINE_LINMATH FLOATNAME(LRotation)(const FLOATNAME(LVector3) &, FLOATTYPE);
|
||||
INLINE_LINMATH FLOATNAME(LRotation)(const FLOATNAME(LMatrix3) &);
|
||||
INLINE_LINMATH FLOATNAME(LRotation)(const FLOATNAME(LMatrix4) &);
|
||||
INLINE_LINMATH FLOATNAME(LRotation)(FLOATTYPE, FLOATTYPE, FLOATTYPE);
|
||||
|
||||
INLINE FLOATNAME(LRotation)
|
||||
INLINE_LINMATH FLOATNAME(LRotation)
|
||||
operator*(const FLOATNAME(LRotation)& other) const;
|
||||
|
||||
INLINE FLOATNAME(LQuaternion)
|
||||
INLINE_LINMATH FLOATNAME(LQuaternion)
|
||||
operator*(const FLOATNAME(LQuaternion)& other) const;
|
||||
|
||||
public:
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
// Function: scalar * LVecBase2
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVecBase2)
|
||||
INLINE_LINMATH FLOATNAME(LVecBase2)
|
||||
operator * (FLOATTYPE scalar, const FLOATNAME(LVecBase2) &a) {
|
||||
return a * scalar;
|
||||
}
|
||||
|
|
@ -16,7 +16,7 @@ operator * (FLOATTYPE scalar, const FLOATNAME(LVecBase2) &a) {
|
|||
// Function: scalar * LPoint2
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LPoint2)
|
||||
INLINE_LINMATH FLOATNAME(LPoint2)
|
||||
operator * (FLOATTYPE scalar, const FLOATNAME(LPoint2) &a) {
|
||||
return a * scalar;
|
||||
}
|
||||
|
|
@ -25,7 +25,7 @@ operator * (FLOATTYPE scalar, const FLOATNAME(LPoint2) &a) {
|
|||
// Function: scalar * LVector2
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVector2)
|
||||
INLINE_LINMATH FLOATNAME(LVector2)
|
||||
operator * (FLOATTYPE scalar, const FLOATNAME(LVector2) &a) {
|
||||
return a * scalar;
|
||||
}
|
||||
|
|
@ -34,7 +34,7 @@ operator * (FLOATTYPE scalar, const FLOATNAME(LVector2) &a) {
|
|||
// Function: dot product of LVecBase2
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATTYPE
|
||||
INLINE_LINMATH FLOATTYPE
|
||||
dot(const FLOATNAME(LVecBase2) &a, const FLOATNAME(LVecBase2) &b) {
|
||||
return a.dot(b);
|
||||
}
|
||||
|
|
@ -43,7 +43,7 @@ dot(const FLOATNAME(LVecBase2) &a, const FLOATNAME(LVecBase2) &b) {
|
|||
// Function: length of a vector
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATTYPE
|
||||
INLINE_LINMATH FLOATTYPE
|
||||
length(const FLOATNAME(LVector2) &a) {
|
||||
return a.length();
|
||||
}
|
||||
|
|
@ -52,7 +52,7 @@ length(const FLOATNAME(LVector2) &a) {
|
|||
// Function: normalize
|
||||
// Description: Returns a normalized vector from the given vector.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVector2)
|
||||
INLINE_LINMATH FLOATNAME(LVector2)
|
||||
normalize(const FLOATNAME(LVector2) &v) {
|
||||
FLOATNAME(LVector2) v1 = v;
|
||||
v1.normalize();
|
||||
|
|
|
|||
|
|
@ -10,27 +10,27 @@
|
|||
|
||||
|
||||
// scalar * vec (vec * scalar is defined in class)
|
||||
INLINE FLOATNAME(LVecBase2)
|
||||
INLINE_LINMATH FLOATNAME(LVecBase2)
|
||||
operator * (FLOATTYPE scalar, const FLOATNAME(LVecBase2) &a);
|
||||
|
||||
INLINE FLOATNAME(LPoint2)
|
||||
INLINE_LINMATH FLOATNAME(LPoint2)
|
||||
operator * (FLOATTYPE scalar, const FLOATNAME(LPoint2) &a);
|
||||
|
||||
INLINE FLOATNAME(LVector2)
|
||||
INLINE_LINMATH FLOATNAME(LVector2)
|
||||
operator * (FLOATTYPE scalar, const FLOATNAME(LVector2) &a);
|
||||
|
||||
|
||||
// dot product
|
||||
INLINE FLOATTYPE
|
||||
INLINE_LINMATH FLOATTYPE
|
||||
dot(const FLOATNAME(LVecBase2) &a, const FLOATNAME(LVecBase2) &b);
|
||||
|
||||
// Length of a vector.
|
||||
INLINE FLOATTYPE
|
||||
INLINE_LINMATH FLOATTYPE
|
||||
length(const FLOATNAME(LVector2) &a);
|
||||
|
||||
|
||||
// A normalized vector.
|
||||
INLINE FLOATNAME(LVector2)
|
||||
INLINE_LINMATH FLOATNAME(LVector2)
|
||||
normalize(const FLOATNAME(LVector2) &v);
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
// Function: scalar * LVecBase3
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVecBase3)
|
||||
INLINE_LINMATH FLOATNAME(LVecBase3)
|
||||
operator * (FLOATTYPE scalar, const FLOATNAME(LVecBase3) &a) {
|
||||
return a * scalar;
|
||||
}
|
||||
|
|
@ -17,7 +17,7 @@ operator * (FLOATTYPE scalar, const FLOATNAME(LVecBase3) &a) {
|
|||
// Function: scalar * LPoint3
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LPoint3)
|
||||
INLINE_LINMATH FLOATNAME(LPoint3)
|
||||
operator * (FLOATTYPE scalar, const FLOATNAME(LPoint3) &a) {
|
||||
return a * scalar;
|
||||
}
|
||||
|
|
@ -26,7 +26,7 @@ operator * (FLOATTYPE scalar, const FLOATNAME(LPoint3) &a) {
|
|||
// Function: scalar * LVector3
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVector3)
|
||||
INLINE_LINMATH FLOATNAME(LVector3)
|
||||
operator * (FLOATTYPE scalar, const FLOATNAME(LVector3) &a) {
|
||||
return a * scalar;
|
||||
}
|
||||
|
|
@ -36,7 +36,7 @@ operator * (FLOATTYPE scalar, const FLOATNAME(LVector3) &a) {
|
|||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
INLINE FLOATTYPE
|
||||
INLINE_LINMATH FLOATTYPE
|
||||
dot(const FLOATNAME(LVecBase3) &a, const FLOATNAME(LVecBase3) &b) {
|
||||
return a.dot(b);
|
||||
}
|
||||
|
|
@ -46,7 +46,7 @@ dot(const FLOATNAME(LVecBase3) &a, const FLOATNAME(LVecBase3) &b) {
|
|||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
INLINE FLOATNAME(LVecBase3)
|
||||
INLINE_LINMATH FLOATNAME(LVecBase3)
|
||||
cross(const FLOATNAME(LVecBase3) &a, const FLOATNAME(LVecBase3) &b) {
|
||||
return a.cross(b);
|
||||
}
|
||||
|
|
@ -56,7 +56,7 @@ cross(const FLOATNAME(LVecBase3) &a, const FLOATNAME(LVecBase3) &b) {
|
|||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
INLINE FLOATNAME(LVector3)
|
||||
INLINE_LINMATH FLOATNAME(LVector3)
|
||||
cross(const FLOATNAME(LVector3) &a, const FLOATNAME(LVector3) &b) {
|
||||
return FLOATNAME(LVector3)(a.cross(b));
|
||||
}
|
||||
|
|
@ -67,7 +67,7 @@ cross(const FLOATNAME(LVector3) &a, const FLOATNAME(LVector3) &b) {
|
|||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
INLINE FLOATTYPE
|
||||
INLINE_LINMATH FLOATTYPE
|
||||
length(const FLOATNAME(LVector3) &a) {
|
||||
return a.length();
|
||||
}
|
||||
|
|
@ -78,7 +78,7 @@ length(const FLOATNAME(LVector3) &a) {
|
|||
// Description: Returns a normalized vector from the given vector.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
INLINE FLOATNAME(LVector3)
|
||||
INLINE_LINMATH FLOATNAME(LVector3)
|
||||
normalize(const FLOATNAME(LVector3) &v) {
|
||||
FLOATNAME(LVector3) v1 = v;
|
||||
v1.normalize();
|
||||
|
|
|
|||
|
|
@ -10,35 +10,35 @@
|
|||
|
||||
|
||||
// scalar * vec (vec * scalar is defined in class)
|
||||
INLINE FLOATNAME(LVecBase3)
|
||||
INLINE_LINMATH FLOATNAME(LVecBase3)
|
||||
operator * (FLOATTYPE scalar, const FLOATNAME(LVecBase3) &a);
|
||||
|
||||
INLINE FLOATNAME(LPoint3)
|
||||
INLINE_LINMATH FLOATNAME(LPoint3)
|
||||
operator * (FLOATTYPE scalar, const FLOATNAME(LPoint3) &a);
|
||||
|
||||
INLINE FLOATNAME(LVector3)
|
||||
INLINE_LINMATH FLOATNAME(LVector3)
|
||||
operator * (FLOATTYPE scalar, const FLOATNAME(LVector3) &a);
|
||||
|
||||
|
||||
// dot product
|
||||
INLINE FLOATTYPE
|
||||
INLINE_LINMATH FLOATTYPE
|
||||
dot(const FLOATNAME(LVecBase3) &a, const FLOATNAME(LVecBase3) &b);
|
||||
|
||||
|
||||
// cross product
|
||||
INLINE FLOATNAME(LVecBase3)
|
||||
INLINE_LINMATH FLOATNAME(LVecBase3)
|
||||
cross(const FLOATNAME(LVecBase3) &a, const FLOATNAME(LVecBase3) &b);
|
||||
|
||||
INLINE FLOATNAME(LVector3)
|
||||
INLINE_LINMATH FLOATNAME(LVector3)
|
||||
cross(const FLOATNAME(LVector3) &a, const FLOATNAME(LVector3) &b);
|
||||
|
||||
|
||||
// Length of a vector.
|
||||
INLINE FLOATTYPE
|
||||
INLINE_LINMATH FLOATTYPE
|
||||
length(const FLOATNAME(LVector3) &a);
|
||||
|
||||
// A normalized vector.
|
||||
INLINE FLOATNAME(LVector3)
|
||||
INLINE_LINMATH FLOATNAME(LVector3)
|
||||
normalize(const FLOATNAME(LVector3) &v);
|
||||
|
||||
#include "lvec3_ops_src.I"
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
// Function: scalar * LVecBase4
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVecBase4)
|
||||
INLINE_LINMATH FLOATNAME(LVecBase4)
|
||||
operator * (FLOATTYPE scalar, const FLOATNAME(LVecBase4) &a) {
|
||||
return a * scalar;
|
||||
}
|
||||
|
|
@ -16,7 +16,7 @@ operator * (FLOATTYPE scalar, const FLOATNAME(LVecBase4) &a) {
|
|||
// Function: scalar * LPoint4
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LPoint4)
|
||||
INLINE_LINMATH FLOATNAME(LPoint4)
|
||||
operator * (FLOATTYPE scalar, const FLOATNAME(LPoint4) &a) {
|
||||
return a * scalar;
|
||||
}
|
||||
|
|
@ -25,7 +25,7 @@ operator * (FLOATTYPE scalar, const FLOATNAME(LPoint4) &a) {
|
|||
// Function: scalar * LVector4
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVector4)
|
||||
INLINE_LINMATH FLOATNAME(LVector4)
|
||||
operator * (FLOATTYPE scalar, const FLOATNAME(LVector4) &a) {
|
||||
return a * scalar;
|
||||
}
|
||||
|
|
@ -35,7 +35,7 @@ operator * (FLOATTYPE scalar, const FLOATNAME(LVector4) &a) {
|
|||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
INLINE FLOATTYPE
|
||||
INLINE_LINMATH FLOATTYPE
|
||||
dot(const FLOATNAME(LVecBase4) &a, const FLOATNAME(LVecBase4) &b) {
|
||||
return a.dot(b);
|
||||
}
|
||||
|
|
@ -45,7 +45,7 @@ dot(const FLOATNAME(LVecBase4) &a, const FLOATNAME(LVecBase4) &b) {
|
|||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
INLINE FLOATTYPE
|
||||
INLINE_LINMATH FLOATTYPE
|
||||
length(const FLOATNAME(LVector4) &a) {
|
||||
return a.length();
|
||||
}
|
||||
|
|
@ -56,7 +56,7 @@ length(const FLOATNAME(LVector4) &a) {
|
|||
// Description: Returns a normalized vector from the given vector.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
INLINE FLOATNAME(LVector4)
|
||||
INLINE_LINMATH FLOATNAME(LVector4)
|
||||
normalize(const FLOATNAME(LVector4) &v) {
|
||||
FLOATNAME(LVector4) v1 = v;
|
||||
v1.normalize();
|
||||
|
|
|
|||
|
|
@ -10,28 +10,28 @@
|
|||
|
||||
|
||||
// scalar * vec (vec * scalar is defined in class)
|
||||
INLINE FLOATNAME(LVecBase4)
|
||||
INLINE_LINMATH FLOATNAME(LVecBase4)
|
||||
operator * (FLOATTYPE scalar, const FLOATNAME(LVecBase4) &a);
|
||||
|
||||
INLINE FLOATNAME(LPoint4)
|
||||
INLINE_LINMATH FLOATNAME(LPoint4)
|
||||
operator * (FLOATTYPE scalar, const FLOATNAME(LPoint4) &a);
|
||||
|
||||
INLINE FLOATNAME(LVector4)
|
||||
INLINE_LINMATH FLOATNAME(LVector4)
|
||||
operator * (FLOATTYPE scalar, const FLOATNAME(LVector4) &a);
|
||||
|
||||
|
||||
// dot product
|
||||
INLINE FLOATTYPE
|
||||
INLINE_LINMATH FLOATTYPE
|
||||
dot(const FLOATNAME(LVecBase4) &a, const FLOATNAME(LVecBase4) &b);
|
||||
|
||||
|
||||
// Length of a vector.
|
||||
INLINE FLOATTYPE
|
||||
INLINE_LINMATH FLOATTYPE
|
||||
length(const FLOATNAME(LVector4) &a);
|
||||
|
||||
|
||||
// A normalized vector.
|
||||
INLINE FLOATNAME(LVector4)
|
||||
INLINE_LINMATH FLOATNAME(LVector4)
|
||||
normalize(const FLOATNAME(LVector4) &v);
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVecBase2)::
|
||||
INLINE_LINMATH FLOATNAME(LVecBase2)::
|
||||
FLOATNAME(LVecBase2)() {
|
||||
}
|
||||
|
||||
|
|
@ -18,9 +18,11 @@ FLOATNAME(LVecBase2)() {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVecBase2)::
|
||||
INLINE_LINMATH FLOATNAME(LVecBase2)::
|
||||
FLOATNAME(LVecBase2)(const FLOATNAME(LVecBase2) ©) {
|
||||
(*this) = copy;
|
||||
_v.v._0 = copy._v.v._0;
|
||||
_v.v._1 = copy._v.v._1;
|
||||
// (*this) = copy;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -28,9 +30,11 @@ FLOATNAME(LVecBase2)(const FLOATNAME(LVecBase2) ©) {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVecBase2) &FLOATNAME(LVecBase2)::
|
||||
INLINE_LINMATH FLOATNAME(LVecBase2) &FLOATNAME(LVecBase2)::
|
||||
operator = (const FLOATNAME(LVecBase2) ©) {
|
||||
set(copy[0], copy[1]);
|
||||
_v.v._0 = copy._v.v._0;
|
||||
_v.v._1 = copy._v.v._1;
|
||||
// set(copy[0], copy[1]);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
|
@ -39,7 +43,7 @@ operator = (const FLOATNAME(LVecBase2) ©) {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVecBase2) &FLOATNAME(LVecBase2)::
|
||||
INLINE_LINMATH FLOATNAME(LVecBase2) &FLOATNAME(LVecBase2)::
|
||||
operator = (FLOATTYPE fill_value) {
|
||||
fill(fill_value);
|
||||
return *this;
|
||||
|
|
@ -50,7 +54,7 @@ operator = (FLOATTYPE fill_value) {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVecBase2)::
|
||||
INLINE_LINMATH FLOATNAME(LVecBase2)::
|
||||
FLOATNAME(LVecBase2)(FLOATTYPE fill_value) {
|
||||
fill(fill_value);
|
||||
}
|
||||
|
|
@ -60,9 +64,11 @@ FLOATNAME(LVecBase2)(FLOATTYPE fill_value) {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVecBase2)::
|
||||
INLINE_LINMATH FLOATNAME(LVecBase2)::
|
||||
FLOATNAME(LVecBase2)(FLOATTYPE x, FLOATTYPE y) {
|
||||
set(x, y);
|
||||
_v.v._0 = x;
|
||||
_v.v._1 = y;
|
||||
// set(x, y);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -70,7 +76,7 @@ FLOATNAME(LVecBase2)(FLOATTYPE x, FLOATTYPE y) {
|
|||
// Access: Public
|
||||
// Description: Returns a zero-length vector.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE const FLOATNAME(LVecBase2) &FLOATNAME(LVecBase2)::
|
||||
INLINE_LINMATH const FLOATNAME(LVecBase2) &FLOATNAME(LVecBase2)::
|
||||
zero() {
|
||||
return _zero;
|
||||
}
|
||||
|
|
@ -80,7 +86,7 @@ zero() {
|
|||
// Access: Public
|
||||
// Description: Returns a unit X vector.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE const FLOATNAME(LVecBase2) &FLOATNAME(LVecBase2)::
|
||||
INLINE_LINMATH const FLOATNAME(LVecBase2) &FLOATNAME(LVecBase2)::
|
||||
unit_x() {
|
||||
return _unit_x;
|
||||
}
|
||||
|
|
@ -90,7 +96,7 @@ unit_x() {
|
|||
// Access: Public
|
||||
// Description: Returns a unit Y vector.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE const FLOATNAME(LVecBase2) &FLOATNAME(LVecBase2)::
|
||||
INLINE_LINMATH const FLOATNAME(LVecBase2) &FLOATNAME(LVecBase2)::
|
||||
unit_y() {
|
||||
return _unit_y;
|
||||
}
|
||||
|
|
@ -100,7 +106,7 @@ unit_y() {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVecBase2)::
|
||||
INLINE_LINMATH FLOATNAME(LVecBase2)::
|
||||
~FLOATNAME(LVecBase2)() {
|
||||
}
|
||||
|
||||
|
|
@ -109,10 +115,10 @@ INLINE FLOATNAME(LVecBase2)::
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATTYPE FLOATNAME(LVecBase2)::
|
||||
INLINE_LINMATH FLOATTYPE FLOATNAME(LVecBase2)::
|
||||
operator [](int i) const {
|
||||
// nassertr(i >= 0 && i < 2, 0);
|
||||
return _data[i];
|
||||
return _v.data[i];
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -120,10 +126,10 @@ operator [](int i) const {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATTYPE &FLOATNAME(LVecBase2)::
|
||||
INLINE_LINMATH FLOATTYPE &FLOATNAME(LVecBase2)::
|
||||
operator [](int i) {
|
||||
// nassertr(i >= 0 && i < 2, _data[0]);
|
||||
return _data[i];
|
||||
// nassertr(i >= 0 && i < 2, _v.v._0);
|
||||
return _v.data[i];
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -132,9 +138,9 @@ operator [](int i) {
|
|||
// Description: Returns true if any component of the vector is
|
||||
// not-a-number, false otherwise.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE bool FLOATNAME(LVecBase2)::
|
||||
INLINE_LINMATH bool FLOATNAME(LVecBase2)::
|
||||
is_nan() const {
|
||||
return cnan(_data[0]) || cnan(_data[1]);
|
||||
return cnan(_v.v._0) || cnan(_v.v._1);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -142,10 +148,10 @@ is_nan() const {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATTYPE FLOATNAME(LVecBase2)::
|
||||
INLINE_LINMATH FLOATTYPE FLOATNAME(LVecBase2)::
|
||||
get_cell(int i) const {
|
||||
// nassertr(i >= 0 && i < 2, 0);
|
||||
return _data[i];
|
||||
return _v.data[i];
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -153,9 +159,9 @@ get_cell(int i) const {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATTYPE FLOATNAME(LVecBase2)::
|
||||
INLINE_LINMATH FLOATTYPE FLOATNAME(LVecBase2)::
|
||||
get_x() const {
|
||||
return _data[0];
|
||||
return _v.v._0;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -163,9 +169,9 @@ get_x() const {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATTYPE FLOATNAME(LVecBase2)::
|
||||
INLINE_LINMATH FLOATTYPE FLOATNAME(LVecBase2)::
|
||||
get_y() const {
|
||||
return _data[1];
|
||||
return _v.v._1;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -173,10 +179,10 @@ get_y() const {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void FLOATNAME(LVecBase2)::
|
||||
INLINE_LINMATH void FLOATNAME(LVecBase2)::
|
||||
set_cell(int i, FLOATTYPE value) {
|
||||
// nassertv(i >= 0 && i < 2);
|
||||
_data[i] = value;
|
||||
_v.data[i] = value;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -184,9 +190,9 @@ set_cell(int i, FLOATTYPE value) {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void FLOATNAME(LVecBase2)::
|
||||
INLINE_LINMATH void FLOATNAME(LVecBase2)::
|
||||
set_x(FLOATTYPE value) {
|
||||
_data[0] = value;
|
||||
_v.v._0 = value;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -194,9 +200,9 @@ set_x(FLOATTYPE value) {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void FLOATNAME(LVecBase2)::
|
||||
INLINE_LINMATH void FLOATNAME(LVecBase2)::
|
||||
set_y(FLOATTYPE value) {
|
||||
_data[1] = value;
|
||||
_v.v._1 = value;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -206,9 +212,9 @@ set_y(FLOATTYPE value) {
|
|||
// elements in the vector. The next element
|
||||
// occupies the next position consecutively in memory.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE const FLOATTYPE *FLOATNAME(LVecBase2)::
|
||||
INLINE_LINMATH const FLOATTYPE *FLOATNAME(LVecBase2)::
|
||||
get_data() const {
|
||||
return _data;
|
||||
return _v.data;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -216,7 +222,7 @@ get_data() const {
|
|||
// Access: Public
|
||||
// Description: Returns the number of elements in the vector, two.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE int FLOATNAME(LVecBase2)::
|
||||
INLINE_LINMATH int FLOATNAME(LVecBase2)::
|
||||
get_num_components() const {
|
||||
return 2;
|
||||
}
|
||||
|
|
@ -227,9 +233,9 @@ get_num_components() const {
|
|||
// Description: Returns an iterator that may be used to traverse the
|
||||
// elements of the matrix, STL-style.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVecBase2)::iterator FLOATNAME(LVecBase2)::
|
||||
INLINE_LINMATH FLOATNAME(LVecBase2)::iterator FLOATNAME(LVecBase2)::
|
||||
begin() {
|
||||
return _data;
|
||||
return _v.data;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -238,7 +244,7 @@ begin() {
|
|||
// Description: Returns an iterator that may be used to traverse the
|
||||
// elements of the matrix, STL-style.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVecBase2)::iterator FLOATNAME(LVecBase2)::
|
||||
INLINE_LINMATH FLOATNAME(LVecBase2)::iterator FLOATNAME(LVecBase2)::
|
||||
end() {
|
||||
return begin() + get_num_components();
|
||||
}
|
||||
|
|
@ -249,9 +255,9 @@ end() {
|
|||
// Description: Returns an iterator that may be used to traverse the
|
||||
// elements of the matrix, STL-style.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVecBase2)::const_iterator FLOATNAME(LVecBase2)::
|
||||
INLINE_LINMATH FLOATNAME(LVecBase2)::const_iterator FLOATNAME(LVecBase2)::
|
||||
begin() const {
|
||||
return _data;
|
||||
return _v.data;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -260,7 +266,7 @@ begin() const {
|
|||
// Description: Returns an iterator that may be used to traverse the
|
||||
// elements of the matrix, STL-style.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVecBase2)::const_iterator FLOATNAME(LVecBase2)::
|
||||
INLINE_LINMATH FLOATNAME(LVecBase2)::const_iterator FLOATNAME(LVecBase2)::
|
||||
end() const {
|
||||
return begin() + get_num_components();
|
||||
}
|
||||
|
|
@ -272,10 +278,10 @@ end() const {
|
|||
// fill_value. This is particularly useful for
|
||||
// initializing to zero.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void FLOATNAME(LVecBase2)::
|
||||
INLINE_LINMATH void FLOATNAME(LVecBase2)::
|
||||
fill(FLOATTYPE fill_value) {
|
||||
_data[0] = fill_value;
|
||||
_data[1] = fill_value;
|
||||
_v.v._0 = fill_value;
|
||||
_v.v._1 = fill_value;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -283,10 +289,10 @@ fill(FLOATTYPE fill_value) {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void FLOATNAME(LVecBase2)::
|
||||
INLINE_LINMATH void FLOATNAME(LVecBase2)::
|
||||
set(FLOATTYPE x, FLOATTYPE y) {
|
||||
_data[0] = x;
|
||||
_data[1] = y;
|
||||
_v.v._0 = x;
|
||||
_v.v._1 = y;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -294,9 +300,9 @@ set(FLOATTYPE x, FLOATTYPE y) {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATTYPE FLOATNAME(LVecBase2)::
|
||||
INLINE_LINMATH FLOATTYPE FLOATNAME(LVecBase2)::
|
||||
dot(const FLOATNAME(LVecBase2) &other) const {
|
||||
return _data[0] * other[0] + _data[1] * other[1];
|
||||
return _v.v._0 * other._v.v._0 + _v.v._1 * other._v.v._1;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -308,7 +314,7 @@ dot(const FLOATNAME(LVecBase2) &other) const {
|
|||
// especially in an STL container. Also see
|
||||
// compare_to().
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE bool FLOATNAME(LVecBase2)::
|
||||
INLINE_LINMATH bool FLOATNAME(LVecBase2)::
|
||||
operator < (const FLOATNAME(LVecBase2) &other) const {
|
||||
return (compare_to(other) < 0);
|
||||
}
|
||||
|
|
@ -318,10 +324,10 @@ operator < (const FLOATNAME(LVecBase2) &other) const {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE bool FLOATNAME(LVecBase2)::
|
||||
INLINE_LINMATH bool FLOATNAME(LVecBase2)::
|
||||
operator == (const FLOATNAME(LVecBase2) &other) const {
|
||||
return (_data[0] == other[0] &&
|
||||
_data[1] == other[1]);
|
||||
return (_v.v._0 == other._v.v._0 &&
|
||||
_v.v._1 == other._v.v._1);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -329,7 +335,7 @@ operator == (const FLOATNAME(LVecBase2) &other) const {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE bool FLOATNAME(LVecBase2)::
|
||||
INLINE_LINMATH bool FLOATNAME(LVecBase2)::
|
||||
operator != (const FLOATNAME(LVecBase2) &other) const {
|
||||
return !operator == (other);
|
||||
}
|
||||
|
|
@ -340,7 +346,7 @@ operator != (const FLOATNAME(LVecBase2) &other) const {
|
|||
// Description: This flavor of compare_to uses a default threshold
|
||||
// value based on the numeric type.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE int FLOATNAME(LVecBase2)::
|
||||
INLINE_LINMATH int FLOATNAME(LVecBase2)::
|
||||
compare_to(const FLOATNAME(LVecBase2) &other) const {
|
||||
return compare_to(other, NEARLY_ZERO(FLOATTYPE));
|
||||
}
|
||||
|
|
@ -354,13 +360,13 @@ compare_to(const FLOATNAME(LVecBase2) &other) const {
|
|||
// after, 0 if they are equivalent (within the indicated
|
||||
// tolerance).
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE int FLOATNAME(LVecBase2)::
|
||||
INLINE_LINMATH int FLOATNAME(LVecBase2)::
|
||||
compare_to(const FLOATNAME(LVecBase2) &other, FLOATTYPE threshold) const {
|
||||
if (!IS_THRESHOLD_EQUAL(_data[0], other[0], threshold)) {
|
||||
return (_data[0] < other[0]) ? -1 : 1;
|
||||
if (!IS_THRESHOLD_EQUAL(_v.v._0, other._v.v._0, threshold)) {
|
||||
return (_v.v._0 < other._v.v._0) ? -1 : 1;
|
||||
}
|
||||
if (!IS_THRESHOLD_EQUAL(_data[1], other[1], threshold)) {
|
||||
return (_data[1] < other[1]) ? -1 : 1;
|
||||
if (!IS_THRESHOLD_EQUAL(_v.v._1, other._v.v._1, threshold)) {
|
||||
return (_v.v._1 < other._v.v._1) ? -1 : 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -370,9 +376,9 @@ compare_to(const FLOATNAME(LVecBase2) &other, FLOATTYPE threshold) const {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVecBase2) FLOATNAME(LVecBase2)::
|
||||
INLINE_LINMATH FLOATNAME(LVecBase2) FLOATNAME(LVecBase2)::
|
||||
operator - () const {
|
||||
return FLOATNAME(LVecBase2)(-_data[0], -_data[1]);
|
||||
return FLOATNAME(LVecBase2)(-_v.v._0, -_v.v._1);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -380,10 +386,10 @@ operator - () const {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVecBase2) FLOATNAME(LVecBase2)::
|
||||
INLINE_LINMATH FLOATNAME(LVecBase2) FLOATNAME(LVecBase2)::
|
||||
operator + (const FLOATNAME(LVecBase2) &other) const {
|
||||
return FLOATNAME(LVecBase2)(_data[0] + other[0],
|
||||
_data[1] + other[1]);
|
||||
return FLOATNAME(LVecBase2)(_v.v._0 + other._v.v._0,
|
||||
_v.v._1 + other._v.v._1);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -391,10 +397,10 @@ operator + (const FLOATNAME(LVecBase2) &other) const {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVecBase2) FLOATNAME(LVecBase2)::
|
||||
INLINE_LINMATH FLOATNAME(LVecBase2) FLOATNAME(LVecBase2)::
|
||||
operator - (const FLOATNAME(LVecBase2) &other) const {
|
||||
return FLOATNAME(LVecBase2)(_data[0] - other[0],
|
||||
_data[1] - other[1]);
|
||||
return FLOATNAME(LVecBase2)(_v.v._0 - other._v.v._0,
|
||||
_v.v._1 - other._v.v._1);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -402,10 +408,10 @@ operator - (const FLOATNAME(LVecBase2) &other) const {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVecBase2) FLOATNAME(LVecBase2)::
|
||||
INLINE_LINMATH FLOATNAME(LVecBase2) FLOATNAME(LVecBase2)::
|
||||
operator * (FLOATTYPE scalar) const {
|
||||
return FLOATNAME(LVecBase2)(_data[0] * scalar,
|
||||
_data[1] * scalar);
|
||||
return FLOATNAME(LVecBase2)(_v.v._0 * scalar,
|
||||
_v.v._1 * scalar);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -413,10 +419,11 @@ operator * (FLOATTYPE scalar) const {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVecBase2) FLOATNAME(LVecBase2)::
|
||||
INLINE_LINMATH FLOATNAME(LVecBase2) FLOATNAME(LVecBase2)::
|
||||
operator / (FLOATTYPE scalar) const {
|
||||
return FLOATNAME(LVecBase2)(_data[0] / scalar,
|
||||
_data[1] / scalar);
|
||||
FLOATTYPE recip_scalar = 1.0/scalar;
|
||||
return FLOATNAME(LVecBase2)(_v.v._0 * recip_scalar,
|
||||
_v.v._1 * recip_scalar);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -424,10 +431,10 @@ operator / (FLOATTYPE scalar) const {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void FLOATNAME(LVecBase2)::
|
||||
INLINE_LINMATH void FLOATNAME(LVecBase2)::
|
||||
operator += (const FLOATNAME(LVecBase2) &other) {
|
||||
_data[0] += other[0];
|
||||
_data[1] += other[1];
|
||||
_v.v._0 += other._v.v._0;
|
||||
_v.v._1 += other._v.v._1;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -435,10 +442,10 @@ operator += (const FLOATNAME(LVecBase2) &other) {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void FLOATNAME(LVecBase2)::
|
||||
INLINE_LINMATH void FLOATNAME(LVecBase2)::
|
||||
operator -= (const FLOATNAME(LVecBase2) &other) {
|
||||
_data[0] -= other[0];
|
||||
_data[1] -= other[1];
|
||||
_v.v._0 -= other._v.v._0;
|
||||
_v.v._1 -= other._v.v._1;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -446,10 +453,10 @@ operator -= (const FLOATNAME(LVecBase2) &other) {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void FLOATNAME(LVecBase2)::
|
||||
INLINE_LINMATH void FLOATNAME(LVecBase2)::
|
||||
operator *= (FLOATTYPE scalar) {
|
||||
_data[0] *= scalar;
|
||||
_data[1] *= scalar;
|
||||
_v.v._0 *= scalar;
|
||||
_v.v._1 *= scalar;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -457,10 +464,11 @@ operator *= (FLOATTYPE scalar) {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void FLOATNAME(LVecBase2)::
|
||||
INLINE_LINMATH void FLOATNAME(LVecBase2)::
|
||||
operator /= (FLOATTYPE scalar) {
|
||||
_data[0] /= scalar;
|
||||
_data[1] /= scalar;
|
||||
FLOATTYPE recip_scalar = 1.0/scalar;
|
||||
_v.v._0 *= recip_scalar;
|
||||
_v.v._1 *= recip_scalar;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -469,10 +477,10 @@ operator /= (FLOATTYPE scalar) {
|
|||
// Description: Returns true if two vectors are memberwise equal
|
||||
// within a specified tolerance.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE bool FLOATNAME(LVecBase2)::
|
||||
INLINE_LINMATH bool FLOATNAME(LVecBase2)::
|
||||
almost_equal(const FLOATNAME(LVecBase2) &other, FLOATTYPE threshold) const {
|
||||
return (IS_THRESHOLD_EQUAL(_data[0], other[0], threshold) &&
|
||||
IS_THRESHOLD_EQUAL(_data[1], other[1], threshold));
|
||||
return (IS_THRESHOLD_EQUAL(_v.v._0, other._v.v._0, threshold) &&
|
||||
IS_THRESHOLD_EQUAL(_v.v._1, other._v.v._1, threshold));
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -481,7 +489,7 @@ almost_equal(const FLOATNAME(LVecBase2) &other, FLOATTYPE threshold) const {
|
|||
// Description: Returns true if two vectors are memberwise equal
|
||||
// within a default tolerance based on the numeric type.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE bool FLOATNAME(LVecBase2)::
|
||||
INLINE_LINMATH bool FLOATNAME(LVecBase2)::
|
||||
almost_equal(const FLOATNAME(LVecBase2) &other) const {
|
||||
return almost_equal(other, NEARLY_ZERO(FLOATTYPE));
|
||||
}
|
||||
|
|
@ -491,10 +499,10 @@ almost_equal(const FLOATNAME(LVecBase2) &other) const {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void FLOATNAME(LVecBase2)::
|
||||
INLINE_LINMATH void FLOATNAME(LVecBase2)::
|
||||
output(ostream &out) const {
|
||||
out << MAYBE_ZERO(_data[0]) << " "
|
||||
<< MAYBE_ZERO(_data[1]);
|
||||
out << MAYBE_ZERO(_v.v._0) << " "
|
||||
<< MAYBE_ZERO(_v.v._1);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -502,10 +510,10 @@ output(ostream &out) const {
|
|||
// Access: Public
|
||||
// Description: Function to write itself into a datagram
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void FLOATNAME(LVecBase2)::
|
||||
INLINE_LINMATH void FLOATNAME(LVecBase2)::
|
||||
write_datagram(Datagram &destination) const {
|
||||
destination.add_float32(_data[0]);
|
||||
destination.add_float32(_data[1]);
|
||||
destination.add_float32(_v.v._0);
|
||||
destination.add_float32(_v.v._1);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -513,9 +521,9 @@ write_datagram(Datagram &destination) const {
|
|||
// Access: Public
|
||||
// Description: Function to read itself from a datagramIterator
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void FLOATNAME(LVecBase2)::
|
||||
INLINE_LINMATH void FLOATNAME(LVecBase2)::
|
||||
read_datagram(DatagramIterator &source) {
|
||||
_data[0] = source.get_float32();
|
||||
_data[1] = source.get_float32();
|
||||
_v.v._0 = source.get_float32();
|
||||
_v.v._1 = source.get_float32();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,9 @@
|
|||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
//typedef struct {FLOATTYPE _0, _1} FLOATNAME(data);
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Class : LVecBase2
|
||||
// Description : This is the base class for all two-component
|
||||
|
|
@ -13,79 +16,82 @@ PUBLISHED:
|
|||
typedef const FLOATTYPE *iterator;
|
||||
typedef const FLOATTYPE *const_iterator;
|
||||
|
||||
INLINE FLOATNAME(LVecBase2)();
|
||||
INLINE FLOATNAME(LVecBase2)(const FLOATNAME(LVecBase2) ©);
|
||||
INLINE FLOATNAME(LVecBase2) &operator = (const FLOATNAME(LVecBase2) ©);
|
||||
INLINE FLOATNAME(LVecBase2) &operator = (FLOATTYPE fill_value);
|
||||
INLINE FLOATNAME(LVecBase2)(FLOATTYPE fill_value);
|
||||
INLINE FLOATNAME(LVecBase2)(FLOATTYPE x, FLOATTYPE y);
|
||||
INLINE_LINMATH FLOATNAME(LVecBase2)();
|
||||
INLINE_LINMATH FLOATNAME(LVecBase2)(const FLOATNAME(LVecBase2) ©);
|
||||
INLINE_LINMATH FLOATNAME(LVecBase2) &operator = (const FLOATNAME(LVecBase2) ©);
|
||||
INLINE_LINMATH FLOATNAME(LVecBase2) &operator = (FLOATTYPE fill_value);
|
||||
INLINE_LINMATH FLOATNAME(LVecBase2)(FLOATTYPE fill_value);
|
||||
INLINE_LINMATH FLOATNAME(LVecBase2)(FLOATTYPE x, FLOATTYPE y);
|
||||
|
||||
INLINE static const FLOATNAME(LVecBase2) &zero();
|
||||
INLINE static const FLOATNAME(LVecBase2) &unit_x();
|
||||
INLINE static const FLOATNAME(LVecBase2) &unit_y();
|
||||
INLINE_LINMATH static const FLOATNAME(LVecBase2) &zero();
|
||||
INLINE_LINMATH static const FLOATNAME(LVecBase2) &unit_x();
|
||||
INLINE_LINMATH static const FLOATNAME(LVecBase2) &unit_y();
|
||||
|
||||
INLINE ~FLOATNAME(LVecBase2)();
|
||||
INLINE_LINMATH ~FLOATNAME(LVecBase2)();
|
||||
|
||||
INLINE FLOATTYPE operator [](int i) const;
|
||||
INLINE FLOATTYPE &operator [](int i);
|
||||
INLINE_LINMATH FLOATTYPE operator [](int i) const;
|
||||
INLINE_LINMATH FLOATTYPE &operator [](int i);
|
||||
|
||||
INLINE bool is_nan() const;
|
||||
INLINE_LINMATH bool is_nan() const;
|
||||
|
||||
INLINE FLOATTYPE get_cell(int i) const;
|
||||
INLINE FLOATTYPE get_x() const;
|
||||
INLINE FLOATTYPE get_y() const;
|
||||
INLINE void set_cell(int i, FLOATTYPE value);
|
||||
INLINE void set_x(FLOATTYPE value);
|
||||
INLINE void set_y(FLOATTYPE value);
|
||||
INLINE_LINMATH FLOATTYPE get_cell(int i) const;
|
||||
INLINE_LINMATH FLOATTYPE get_x() const;
|
||||
INLINE_LINMATH FLOATTYPE get_y() const;
|
||||
INLINE_LINMATH void set_cell(int i, FLOATTYPE value);
|
||||
INLINE_LINMATH void set_x(FLOATTYPE value);
|
||||
INLINE_LINMATH void set_y(FLOATTYPE value);
|
||||
|
||||
INLINE const FLOATTYPE *get_data() const;
|
||||
INLINE int get_num_components() const;
|
||||
INLINE_LINMATH const FLOATTYPE *get_data() const;
|
||||
INLINE_LINMATH int get_num_components() const;
|
||||
|
||||
public:
|
||||
INLINE iterator begin();
|
||||
INLINE iterator end();
|
||||
INLINE_LINMATH iterator begin();
|
||||
INLINE_LINMATH iterator end();
|
||||
|
||||
INLINE const_iterator begin() const;
|
||||
INLINE const_iterator end() const;
|
||||
INLINE_LINMATH const_iterator begin() const;
|
||||
INLINE_LINMATH const_iterator end() const;
|
||||
|
||||
PUBLISHED:
|
||||
INLINE void fill(FLOATTYPE fill_value);
|
||||
INLINE void set(FLOATTYPE x, FLOATTYPE y);
|
||||
INLINE_LINMATH void fill(FLOATTYPE fill_value);
|
||||
INLINE_LINMATH void set(FLOATTYPE x, FLOATTYPE y);
|
||||
|
||||
INLINE FLOATTYPE dot(const FLOATNAME(LVecBase2) &other) const;
|
||||
INLINE_LINMATH FLOATTYPE dot(const FLOATNAME(LVecBase2) &other) const;
|
||||
|
||||
INLINE bool operator < (const FLOATNAME(LVecBase2) &other) const;
|
||||
INLINE bool operator == (const FLOATNAME(LVecBase2) &other) const;
|
||||
INLINE bool operator != (const FLOATNAME(LVecBase2) &other) const;
|
||||
INLINE_LINMATH bool operator < (const FLOATNAME(LVecBase2) &other) const;
|
||||
INLINE_LINMATH bool operator == (const FLOATNAME(LVecBase2) &other) const;
|
||||
INLINE_LINMATH bool operator != (const FLOATNAME(LVecBase2) &other) const;
|
||||
|
||||
INLINE int compare_to(const FLOATNAME(LVecBase2) &other) const;
|
||||
INLINE int compare_to(const FLOATNAME(LVecBase2) &other,
|
||||
INLINE_LINMATH int compare_to(const FLOATNAME(LVecBase2) &other) const;
|
||||
INLINE_LINMATH int compare_to(const FLOATNAME(LVecBase2) &other,
|
||||
FLOATTYPE threshold) const;
|
||||
|
||||
INLINE FLOATNAME(LVecBase2) operator - () const;
|
||||
INLINE_LINMATH FLOATNAME(LVecBase2) operator - () const;
|
||||
|
||||
INLINE FLOATNAME(LVecBase2)
|
||||
INLINE_LINMATH FLOATNAME(LVecBase2)
|
||||
operator + (const FLOATNAME(LVecBase2) &other) const;
|
||||
INLINE FLOATNAME(LVecBase2)
|
||||
INLINE_LINMATH FLOATNAME(LVecBase2)
|
||||
operator - (const FLOATNAME(LVecBase2) &other) const;
|
||||
|
||||
INLINE FLOATNAME(LVecBase2) operator * (FLOATTYPE scalar) const;
|
||||
INLINE FLOATNAME(LVecBase2) operator / (FLOATTYPE scalar) const;
|
||||
INLINE_LINMATH FLOATNAME(LVecBase2) operator * (FLOATTYPE scalar) const;
|
||||
INLINE_LINMATH FLOATNAME(LVecBase2) operator / (FLOATTYPE scalar) const;
|
||||
|
||||
INLINE void operator += (const FLOATNAME(LVecBase2) &other);
|
||||
INLINE void operator -= (const FLOATNAME(LVecBase2) &other);
|
||||
INLINE_LINMATH void operator += (const FLOATNAME(LVecBase2) &other);
|
||||
INLINE_LINMATH void operator -= (const FLOATNAME(LVecBase2) &other);
|
||||
|
||||
INLINE void operator *= (FLOATTYPE scalar);
|
||||
INLINE void operator /= (FLOATTYPE scalar);
|
||||
INLINE_LINMATH void operator *= (FLOATTYPE scalar);
|
||||
INLINE_LINMATH void operator /= (FLOATTYPE scalar);
|
||||
|
||||
INLINE bool almost_equal(const FLOATNAME(LVecBase2) &other,
|
||||
INLINE_LINMATH bool almost_equal(const FLOATNAME(LVecBase2) &other,
|
||||
FLOATTYPE threshold) const;
|
||||
INLINE bool almost_equal(const FLOATNAME(LVecBase2) &other) const;
|
||||
INLINE_LINMATH bool almost_equal(const FLOATNAME(LVecBase2) &other) const;
|
||||
|
||||
INLINE void output(ostream &out) const;
|
||||
INLINE_LINMATH void output(ostream &out) const;
|
||||
|
||||
protected:
|
||||
FLOATTYPE _data[2];
|
||||
public:
|
||||
union {
|
||||
FLOATTYPE data[2];
|
||||
struct {FLOATTYPE _0, _1;} v;
|
||||
} _v;
|
||||
|
||||
private:
|
||||
static const FLOATNAME(LVecBase2) _zero;
|
||||
|
|
@ -93,8 +99,8 @@ private:
|
|||
static const FLOATNAME(LVecBase2) _unit_y;
|
||||
|
||||
public:
|
||||
INLINE void write_datagram(Datagram &destination) const;
|
||||
INLINE void read_datagram(DatagramIterator &source);
|
||||
INLINE_LINMATH void write_datagram(Datagram &destination) const;
|
||||
INLINE_LINMATH void read_datagram(DatagramIterator &source);
|
||||
|
||||
public:
|
||||
static TypeHandle get_class_type() {
|
||||
|
|
@ -107,7 +113,7 @@ private:
|
|||
};
|
||||
|
||||
|
||||
INLINE ostream &operator << (ostream &out, const FLOATNAME(LVecBase2) &vec) {
|
||||
INLINE_LINMATH ostream &operator << (ostream &out, const FLOATNAME(LVecBase2) &vec) {
|
||||
vec.output(out);
|
||||
return out;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVecBase3)::
|
||||
INLINE_LINMATH FLOATNAME(LVecBase3)::
|
||||
FLOATNAME(LVecBase3)() {
|
||||
}
|
||||
|
||||
|
|
@ -17,9 +17,12 @@ FLOATNAME(LVecBase3)() {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVecBase3)::
|
||||
INLINE_LINMATH FLOATNAME(LVecBase3)::
|
||||
FLOATNAME(LVecBase3)(const FLOATNAME(LVecBase3) ©) {
|
||||
(*this) = copy;
|
||||
_v.v._0 = copy._v.v._0;
|
||||
_v.v._1 = copy._v.v._1;
|
||||
_v.v._2 = copy._v.v._2;
|
||||
// (*this) = copy;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -27,9 +30,12 @@ FLOATNAME(LVecBase3)(const FLOATNAME(LVecBase3) ©) {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVecBase3) &FLOATNAME(LVecBase3)::
|
||||
INLINE_LINMATH FLOATNAME(LVecBase3) &FLOATNAME(LVecBase3)::
|
||||
operator = (const FLOATNAME(LVecBase3) ©) {
|
||||
set(copy[0], copy[1], copy[2]);
|
||||
_v.v._0 = copy._v.v._0;
|
||||
_v.v._1 = copy._v.v._1;
|
||||
_v.v._2 = copy._v.v._2;
|
||||
// set(copy[0], copy[1], copy[2]);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
|
@ -38,7 +44,7 @@ operator = (const FLOATNAME(LVecBase3) ©) {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVecBase3) &FLOATNAME(LVecBase3)::
|
||||
INLINE_LINMATH FLOATNAME(LVecBase3) &FLOATNAME(LVecBase3)::
|
||||
operator = (FLOATTYPE fill_value) {
|
||||
fill(fill_value);
|
||||
return *this;
|
||||
|
|
@ -49,7 +55,7 @@ operator = (FLOATTYPE fill_value) {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVecBase3)::
|
||||
INLINE_LINMATH FLOATNAME(LVecBase3)::
|
||||
FLOATNAME(LVecBase3)(FLOATTYPE fill_value) {
|
||||
fill(fill_value);
|
||||
}
|
||||
|
|
@ -59,9 +65,12 @@ FLOATNAME(LVecBase3)(FLOATTYPE fill_value) {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVecBase3)::
|
||||
INLINE_LINMATH FLOATNAME(LVecBase3)::
|
||||
FLOATNAME(LVecBase3)(FLOATTYPE x, FLOATTYPE y, FLOATTYPE z) {
|
||||
set(x, y, z);
|
||||
_v.v._0 = x;
|
||||
_v.v._1 = y;
|
||||
_v.v._2 = z;
|
||||
// set(x, y, z);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -69,7 +78,7 @@ FLOATNAME(LVecBase3)(FLOATTYPE x, FLOATTYPE y, FLOATTYPE z) {
|
|||
// Access: Public
|
||||
// Description: Returns a zero-length vector.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE const FLOATNAME(LVecBase3) &FLOATNAME(LVecBase3)::
|
||||
INLINE_LINMATH const FLOATNAME(LVecBase3) &FLOATNAME(LVecBase3)::
|
||||
zero() {
|
||||
return _zero;
|
||||
}
|
||||
|
|
@ -79,7 +88,7 @@ zero() {
|
|||
// Access: Public
|
||||
// Description: Returns a unit X vector.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE const FLOATNAME(LVecBase3) &FLOATNAME(LVecBase3)::
|
||||
INLINE_LINMATH const FLOATNAME(LVecBase3) &FLOATNAME(LVecBase3)::
|
||||
unit_x() {
|
||||
return _unit_x;
|
||||
}
|
||||
|
|
@ -89,7 +98,7 @@ unit_x() {
|
|||
// Access: Public
|
||||
// Description: Returns a unit Y vector.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE const FLOATNAME(LVecBase3) &FLOATNAME(LVecBase3)::
|
||||
INLINE_LINMATH const FLOATNAME(LVecBase3) &FLOATNAME(LVecBase3)::
|
||||
unit_y() {
|
||||
return _unit_y;
|
||||
}
|
||||
|
|
@ -99,7 +108,7 @@ unit_y() {
|
|||
// Access: Public
|
||||
// Description: Returns a unit Z vector.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE const FLOATNAME(LVecBase3) &FLOATNAME(LVecBase3)::
|
||||
INLINE_LINMATH const FLOATNAME(LVecBase3) &FLOATNAME(LVecBase3)::
|
||||
unit_z() {
|
||||
return _unit_z;
|
||||
}
|
||||
|
|
@ -109,7 +118,7 @@ unit_z() {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVecBase3)::
|
||||
INLINE_LINMATH FLOATNAME(LVecBase3)::
|
||||
~FLOATNAME(LVecBase3)() {
|
||||
}
|
||||
|
||||
|
|
@ -118,10 +127,10 @@ INLINE FLOATNAME(LVecBase3)::
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATTYPE FLOATNAME(LVecBase3)::
|
||||
INLINE_LINMATH FLOATTYPE FLOATNAME(LVecBase3)::
|
||||
operator [](int i) const {
|
||||
//nassertr(i >= 0 && i < 3, 0);
|
||||
return _data[i];
|
||||
return _v.data[i];
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -129,10 +138,10 @@ operator [](int i) const {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATTYPE &FLOATNAME(LVecBase3)::
|
||||
INLINE_LINMATH FLOATTYPE &FLOATNAME(LVecBase3)::
|
||||
operator [](int i) {
|
||||
//nassertr(i >= 0 && i < 3, _data[0]);
|
||||
return _data[i];
|
||||
//nassertr(i >= 0 && i < 3, _v.v._0);
|
||||
return _v.data[i];
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -141,9 +150,9 @@ operator [](int i) {
|
|||
// Description: Returns true if any component of the vector is
|
||||
// not-a-number, false otherwise.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE bool FLOATNAME(LVecBase3)::
|
||||
INLINE_LINMATH bool FLOATNAME(LVecBase3)::
|
||||
is_nan() const {
|
||||
return cnan(_data[0]) || cnan(_data[1]) || cnan(_data[2]);
|
||||
return cnan(_v.v._0) || cnan(_v.v._1) || cnan(_v.v._2);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -151,10 +160,10 @@ is_nan() const {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATTYPE FLOATNAME(LVecBase3)::
|
||||
INLINE_LINMATH FLOATTYPE FLOATNAME(LVecBase3)::
|
||||
get_cell(int i) const {
|
||||
// nassertr(i >= 0 && i < 3, 0);
|
||||
return _data[i];
|
||||
return _v.data[i];
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -162,9 +171,9 @@ get_cell(int i) const {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATTYPE FLOATNAME(LVecBase3)::
|
||||
INLINE_LINMATH FLOATTYPE FLOATNAME(LVecBase3)::
|
||||
get_x() const {
|
||||
return _data[0];
|
||||
return _v.v._0;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -172,9 +181,9 @@ get_x() const {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATTYPE FLOATNAME(LVecBase3)::
|
||||
INLINE_LINMATH FLOATTYPE FLOATNAME(LVecBase3)::
|
||||
get_y() const {
|
||||
return _data[1];
|
||||
return _v.v._1;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -182,9 +191,9 @@ get_y() const {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATTYPE FLOATNAME(LVecBase3)::
|
||||
INLINE_LINMATH FLOATTYPE FLOATNAME(LVecBase3)::
|
||||
get_z() const {
|
||||
return _data[2];
|
||||
return _v.v._2;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -192,10 +201,10 @@ get_z() const {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void FLOATNAME(LVecBase3)::
|
||||
INLINE_LINMATH void FLOATNAME(LVecBase3)::
|
||||
set_cell(int i, FLOATTYPE value) {
|
||||
// nassertv(i >= 0 && i < 3);
|
||||
_data[i] = value;
|
||||
_v.data[i] = value;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -203,9 +212,9 @@ set_cell(int i, FLOATTYPE value) {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void FLOATNAME(LVecBase3)::
|
||||
INLINE_LINMATH void FLOATNAME(LVecBase3)::
|
||||
set_x(FLOATTYPE value) {
|
||||
_data[0] = value;
|
||||
_v.v._0 = value;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -213,9 +222,9 @@ set_x(FLOATTYPE value) {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void FLOATNAME(LVecBase3)::
|
||||
INLINE_LINMATH void FLOATNAME(LVecBase3)::
|
||||
set_y(FLOATTYPE value) {
|
||||
_data[1] = value;
|
||||
_v.v._1 = value;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -223,9 +232,9 @@ set_y(FLOATTYPE value) {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void FLOATNAME(LVecBase3)::
|
||||
INLINE_LINMATH void FLOATNAME(LVecBase3)::
|
||||
set_z(FLOATTYPE value) {
|
||||
_data[2] = value;
|
||||
_v.v._2 = value;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -235,9 +244,9 @@ set_z(FLOATTYPE value) {
|
|||
// elements in the vector. The remaining elements
|
||||
// occupy the next positions consecutively in memory.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE const FLOATTYPE *FLOATNAME(LVecBase3)::
|
||||
INLINE_LINMATH const FLOATTYPE *FLOATNAME(LVecBase3)::
|
||||
get_data() const {
|
||||
return _data;
|
||||
return _v.data;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -245,7 +254,7 @@ get_data() const {
|
|||
// Access: Public
|
||||
// Description: Returns the number of elements in the vector, three.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE int FLOATNAME(LVecBase3)::
|
||||
INLINE_LINMATH int FLOATNAME(LVecBase3)::
|
||||
get_num_components() const {
|
||||
return 3;
|
||||
}
|
||||
|
|
@ -256,9 +265,9 @@ get_num_components() const {
|
|||
// Description: Returns an iterator that may be used to traverse the
|
||||
// elements of the matrix, STL-style.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVecBase3)::iterator FLOATNAME(LVecBase3)::
|
||||
INLINE_LINMATH FLOATNAME(LVecBase3)::iterator FLOATNAME(LVecBase3)::
|
||||
begin() {
|
||||
return _data;
|
||||
return _v.data;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -267,7 +276,7 @@ begin() {
|
|||
// Description: Returns an iterator that may be used to traverse the
|
||||
// elements of the matrix, STL-style.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVecBase3)::iterator FLOATNAME(LVecBase3)::
|
||||
INLINE_LINMATH FLOATNAME(LVecBase3)::iterator FLOATNAME(LVecBase3)::
|
||||
end() {
|
||||
return begin() + get_num_components();
|
||||
}
|
||||
|
|
@ -278,9 +287,9 @@ end() {
|
|||
// Description: Returns an iterator that may be used to traverse the
|
||||
// elements of the matrix, STL-style.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVecBase3)::const_iterator FLOATNAME(LVecBase3)::
|
||||
INLINE_LINMATH FLOATNAME(LVecBase3)::const_iterator FLOATNAME(LVecBase3)::
|
||||
begin() const {
|
||||
return _data;
|
||||
return _v.data;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -289,7 +298,7 @@ begin() const {
|
|||
// Description: Returns an iterator that may be used to traverse the
|
||||
// elements of the matrix, STL-style.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVecBase3)::const_iterator FLOATNAME(LVecBase3)::
|
||||
INLINE_LINMATH FLOATNAME(LVecBase3)::const_iterator FLOATNAME(LVecBase3)::
|
||||
end() const {
|
||||
return begin() + get_num_components();
|
||||
}
|
||||
|
|
@ -301,11 +310,11 @@ end() const {
|
|||
// fill_value. This is particularly useful for
|
||||
// initializing to zero.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void FLOATNAME(LVecBase3)::
|
||||
INLINE_LINMATH void FLOATNAME(LVecBase3)::
|
||||
fill(FLOATTYPE fill_value) {
|
||||
_data[0] = fill_value;
|
||||
_data[1] = fill_value;
|
||||
_data[2] = fill_value;
|
||||
_v.v._0 = fill_value;
|
||||
_v.v._1 = fill_value;
|
||||
_v.v._2 = fill_value;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -313,11 +322,11 @@ fill(FLOATTYPE fill_value) {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void FLOATNAME(LVecBase3)::
|
||||
INLINE_LINMATH void FLOATNAME(LVecBase3)::
|
||||
set(FLOATTYPE x, FLOATTYPE y, FLOATTYPE z) {
|
||||
_data[0] = x;
|
||||
_data[1] = y;
|
||||
_data[2] = z;
|
||||
_v.v._0 = x;
|
||||
_v.v._1 = y;
|
||||
_v.v._2 = z;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -325,9 +334,9 @@ set(FLOATTYPE x, FLOATTYPE y, FLOATTYPE z) {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATTYPE FLOATNAME(LVecBase3)::
|
||||
INLINE_LINMATH FLOATTYPE FLOATNAME(LVecBase3)::
|
||||
dot(const FLOATNAME(LVecBase3) &other) const {
|
||||
return _data[0] * other[0] + _data[1] * other[1] + _data[2] * other[2];
|
||||
return _v.v._0 * other._v.v._0 + _v.v._1 * other._v.v._1 + _v.v._2 * other._v.v._2;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -335,11 +344,11 @@ dot(const FLOATNAME(LVecBase3) &other) const {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVecBase3) FLOATNAME(LVecBase3)::
|
||||
INLINE_LINMATH FLOATNAME(LVecBase3) FLOATNAME(LVecBase3)::
|
||||
cross(const FLOATNAME(LVecBase3) &other) const {
|
||||
return FLOATNAME(LVecBase3)(_data[1] * other[2] - other[1] * _data[2],
|
||||
other[0] * _data[2] - _data[0] * other[2],
|
||||
_data[0] * other[1] - other[0] * _data[1]);
|
||||
return FLOATNAME(LVecBase3)(_v.v._1 * other._v.v._2 - other._v.v._1 * _v.v._2,
|
||||
other._v.v._0 * _v.v._2 - _v.v._0 * other._v.v._2,
|
||||
_v.v._0 * other._v.v._1 - other._v.v._0 * _v.v._1);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -351,7 +360,7 @@ cross(const FLOATNAME(LVecBase3) &other) const {
|
|||
// especially in an STL container. Also see
|
||||
// compare_to().
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE bool FLOATNAME(LVecBase3)::
|
||||
INLINE_LINMATH bool FLOATNAME(LVecBase3)::
|
||||
operator < (const FLOATNAME(LVecBase3) &other) const {
|
||||
return (compare_to(other) < 0);
|
||||
}
|
||||
|
|
@ -361,11 +370,11 @@ operator < (const FLOATNAME(LVecBase3) &other) const {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE bool FLOATNAME(LVecBase3)::
|
||||
INLINE_LINMATH bool FLOATNAME(LVecBase3)::
|
||||
operator == (const FLOATNAME(LVecBase3) &other) const {
|
||||
return (_data[0] == other[0] &&
|
||||
_data[1] == other[1] &&
|
||||
_data[2] == other[2]);
|
||||
return (_v.v._0 == other._v.v._0 &&
|
||||
_v.v._1 == other._v.v._1 &&
|
||||
_v.v._2 == other._v.v._2);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -373,7 +382,7 @@ operator == (const FLOATNAME(LVecBase3) &other) const {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE bool FLOATNAME(LVecBase3)::
|
||||
INLINE_LINMATH bool FLOATNAME(LVecBase3)::
|
||||
operator != (const FLOATNAME(LVecBase3) &other) const {
|
||||
return !operator == (other);
|
||||
}
|
||||
|
|
@ -384,7 +393,7 @@ operator != (const FLOATNAME(LVecBase3) &other) const {
|
|||
// Description: This flavor of compare_to uses a default threshold
|
||||
// value based on the numeric type.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE int FLOATNAME(LVecBase3)::
|
||||
INLINE_LINMATH int FLOATNAME(LVecBase3)::
|
||||
compare_to(const FLOATNAME(LVecBase3) &other) const {
|
||||
return compare_to(other, NEARLY_ZERO(FLOATTYPE));
|
||||
}
|
||||
|
|
@ -398,16 +407,16 @@ compare_to(const FLOATNAME(LVecBase3) &other) const {
|
|||
// after, 0 if they are equivalent (within the indicated
|
||||
// tolerance).
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE int FLOATNAME(LVecBase3)::
|
||||
INLINE_LINMATH int FLOATNAME(LVecBase3)::
|
||||
compare_to(const FLOATNAME(LVecBase3) &other, FLOATTYPE threshold) const {
|
||||
if (!IS_THRESHOLD_EQUAL(_data[0], other[0], threshold)) {
|
||||
return (_data[0] < other[0]) ? -1 : 1;
|
||||
if (!IS_THRESHOLD_EQUAL(_v.v._0, other._v.v._0, threshold)) {
|
||||
return (_v.v._0 < other._v.v._0) ? -1 : 1;
|
||||
}
|
||||
if (!IS_THRESHOLD_EQUAL(_data[1], other[1], threshold)) {
|
||||
return (_data[1] < other[1]) ? -1 : 1;
|
||||
if (!IS_THRESHOLD_EQUAL(_v.v._1, other._v.v._1, threshold)) {
|
||||
return (_v.v._1 < other._v.v._1) ? -1 : 1;
|
||||
}
|
||||
if (!IS_THRESHOLD_EQUAL(_data[2], other[2], threshold)) {
|
||||
return (_data[2] < other[2]) ? -1 : 1;
|
||||
if (!IS_THRESHOLD_EQUAL(_v.v._2, other._v.v._2, threshold)) {
|
||||
return (_v.v._2 < other._v.v._2) ? -1 : 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -417,9 +426,9 @@ compare_to(const FLOATNAME(LVecBase3) &other, FLOATTYPE threshold) const {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVecBase3) FLOATNAME(LVecBase3)::
|
||||
INLINE_LINMATH FLOATNAME(LVecBase3) FLOATNAME(LVecBase3)::
|
||||
operator - () const {
|
||||
return FLOATNAME(LVecBase3)(-_data[0], -_data[1], -_data[2]);
|
||||
return FLOATNAME(LVecBase3)(-_v.v._0, -_v.v._1, -_v.v._2);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -427,11 +436,11 @@ operator - () const {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVecBase3) FLOATNAME(LVecBase3)::
|
||||
INLINE_LINMATH FLOATNAME(LVecBase3) FLOATNAME(LVecBase3)::
|
||||
operator + (const FLOATNAME(LVecBase3) &other) const {
|
||||
return FLOATNAME(LVecBase3)(_data[0] + other[0],
|
||||
_data[1] + other[1],
|
||||
_data[2] + other[2]);
|
||||
return FLOATNAME(LVecBase3)(_v.v._0 + other._v.v._0,
|
||||
_v.v._1 + other._v.v._1,
|
||||
_v.v._2 + other._v.v._2);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -439,11 +448,11 @@ operator + (const FLOATNAME(LVecBase3) &other) const {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVecBase3) FLOATNAME(LVecBase3)::
|
||||
INLINE_LINMATH FLOATNAME(LVecBase3) FLOATNAME(LVecBase3)::
|
||||
operator - (const FLOATNAME(LVecBase3) &other) const {
|
||||
return FLOATNAME(LVecBase3)(_data[0] - other[0],
|
||||
_data[1] - other[1],
|
||||
_data[2] - other[2]);
|
||||
return FLOATNAME(LVecBase3)(_v.v._0 - other._v.v._0,
|
||||
_v.v._1 - other._v.v._1,
|
||||
_v.v._2 - other._v.v._2);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -451,11 +460,11 @@ operator - (const FLOATNAME(LVecBase3) &other) const {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVecBase3) FLOATNAME(LVecBase3)::
|
||||
INLINE_LINMATH FLOATNAME(LVecBase3) FLOATNAME(LVecBase3)::
|
||||
operator * (FLOATTYPE scalar) const {
|
||||
return FLOATNAME(LVecBase3)(_data[0] * scalar,
|
||||
_data[1] * scalar,
|
||||
_data[2] * scalar);
|
||||
return FLOATNAME(LVecBase3)(_v.v._0 * scalar,
|
||||
_v.v._1 * scalar,
|
||||
_v.v._2 * scalar);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -463,11 +472,11 @@ operator * (FLOATTYPE scalar) const {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVecBase3) FLOATNAME(LVecBase3)::
|
||||
INLINE_LINMATH FLOATNAME(LVecBase3) FLOATNAME(LVecBase3)::
|
||||
operator / (FLOATTYPE scalar) const {
|
||||
return FLOATNAME(LVecBase3)(_data[0] / scalar,
|
||||
_data[1] / scalar,
|
||||
_data[2] / scalar);
|
||||
return FLOATNAME(LVecBase3)(_v.v._0 / scalar,
|
||||
_v.v._1 / scalar,
|
||||
_v.v._2 / scalar);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -475,11 +484,11 @@ operator / (FLOATTYPE scalar) const {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void FLOATNAME(LVecBase3)::
|
||||
INLINE_LINMATH void FLOATNAME(LVecBase3)::
|
||||
operator += (const FLOATNAME(LVecBase3) &other) {
|
||||
_data[0] += other[0];
|
||||
_data[1] += other[1];
|
||||
_data[2] += other[2];
|
||||
_v.v._0 += other._v.v._0;
|
||||
_v.v._1 += other._v.v._1;
|
||||
_v.v._2 += other._v.v._2;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -487,11 +496,11 @@ operator += (const FLOATNAME(LVecBase3) &other) {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void FLOATNAME(LVecBase3)::
|
||||
INLINE_LINMATH void FLOATNAME(LVecBase3)::
|
||||
operator -= (const FLOATNAME(LVecBase3) &other) {
|
||||
_data[0] -= other[0];
|
||||
_data[1] -= other[1];
|
||||
_data[2] -= other[2];
|
||||
_v.v._0 -= other._v.v._0;
|
||||
_v.v._1 -= other._v.v._1;
|
||||
_v.v._2 -= other._v.v._2;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -499,11 +508,11 @@ operator -= (const FLOATNAME(LVecBase3) &other) {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void FLOATNAME(LVecBase3)::
|
||||
INLINE_LINMATH void FLOATNAME(LVecBase3)::
|
||||
operator *= (FLOATTYPE scalar) {
|
||||
_data[0] *= scalar;
|
||||
_data[1] *= scalar;
|
||||
_data[2] *= scalar;
|
||||
_v.v._0 *= scalar;
|
||||
_v.v._1 *= scalar;
|
||||
_v.v._2 *= scalar;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -511,11 +520,12 @@ operator *= (FLOATTYPE scalar) {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void FLOATNAME(LVecBase3)::
|
||||
INLINE_LINMATH void FLOATNAME(LVecBase3)::
|
||||
operator /= (FLOATTYPE scalar) {
|
||||
_data[0] /= scalar;
|
||||
_data[1] /= scalar;
|
||||
_data[2] /= scalar;
|
||||
FLOATTYPE recip_scalar = 1.0/scalar;
|
||||
_v.v._0 *= recip_scalar;
|
||||
_v.v._1 *= recip_scalar;
|
||||
_v.v._2 *= recip_scalar;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -523,7 +533,7 @@ operator /= (FLOATTYPE scalar) {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void FLOATNAME(LVecBase3)::
|
||||
INLINE_LINMATH void FLOATNAME(LVecBase3)::
|
||||
cross_into(const FLOATNAME(LVecBase3) &other) {
|
||||
(*this) = cross(other);
|
||||
}
|
||||
|
|
@ -534,11 +544,11 @@ cross_into(const FLOATNAME(LVecBase3) &other) {
|
|||
// Description: Returns true if two vectors are memberwise equal
|
||||
// within a specified tolerance.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE bool FLOATNAME(LVecBase3)::
|
||||
INLINE_LINMATH bool FLOATNAME(LVecBase3)::
|
||||
almost_equal(const FLOATNAME(LVecBase3) &other, FLOATTYPE threshold) const {
|
||||
return (IS_THRESHOLD_EQUAL(_data[0], other[0], threshold) &&
|
||||
IS_THRESHOLD_EQUAL(_data[1], other[1], threshold) &&
|
||||
IS_THRESHOLD_EQUAL(_data[2], other[2], threshold));
|
||||
return (IS_THRESHOLD_EQUAL(_v.v._0, other._v.v._0, threshold) &&
|
||||
IS_THRESHOLD_EQUAL(_v.v._1, other._v.v._1, threshold) &&
|
||||
IS_THRESHOLD_EQUAL(_v.v._2, other._v.v._2, threshold));
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -547,7 +557,7 @@ almost_equal(const FLOATNAME(LVecBase3) &other, FLOATTYPE threshold) const {
|
|||
// Description: Returns true if two vectors are memberwise equal
|
||||
// within a default tolerance based on the numeric type.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE bool FLOATNAME(LVecBase3)::
|
||||
INLINE_LINMATH bool FLOATNAME(LVecBase3)::
|
||||
almost_equal(const FLOATNAME(LVecBase3) &other) const {
|
||||
return almost_equal(other, NEARLY_ZERO(FLOATTYPE));
|
||||
}
|
||||
|
|
@ -557,11 +567,11 @@ almost_equal(const FLOATNAME(LVecBase3) &other) const {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void FLOATNAME(LVecBase3)::
|
||||
INLINE_LINMATH void FLOATNAME(LVecBase3)::
|
||||
output(ostream &out) const {
|
||||
out << MAYBE_ZERO(_data[0]) << " "
|
||||
<< MAYBE_ZERO(_data[1]) << " "
|
||||
<< MAYBE_ZERO(_data[2]);
|
||||
out << MAYBE_ZERO(_v.v._0) << " "
|
||||
<< MAYBE_ZERO(_v.v._1) << " "
|
||||
<< MAYBE_ZERO(_v.v._2);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -570,11 +580,11 @@ output(ostream &out) const {
|
|||
// Access: Public
|
||||
// Description: Function to write itself into a datagram
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void FLOATNAME(LVecBase3)::
|
||||
INLINE_LINMATH void FLOATNAME(LVecBase3)::
|
||||
write_datagram(Datagram &destination) const {
|
||||
destination.add_float32(_data[0]);
|
||||
destination.add_float32(_data[1]);
|
||||
destination.add_float32(_data[2]);
|
||||
destination.add_float32(_v.v._0);
|
||||
destination.add_float32(_v.v._1);
|
||||
destination.add_float32(_v.v._2);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -582,9 +592,9 @@ write_datagram(Datagram &destination) const {
|
|||
// Access: Public
|
||||
// Description: Function to read itself from a datagramIterator
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void FLOATNAME(LVecBase3)::
|
||||
INLINE_LINMATH void FLOATNAME(LVecBase3)::
|
||||
read_datagram(DatagramIterator &source) {
|
||||
_data[0] = source.get_float32();
|
||||
_data[1] = source.get_float32();
|
||||
_data[2] = source.get_float32();
|
||||
_v.v._0 = source.get_float32();
|
||||
_v.v._1 = source.get_float32();
|
||||
_v.v._2 = source.get_float32();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,85 +13,88 @@ PUBLISHED:
|
|||
typedef const FLOATTYPE *iterator;
|
||||
typedef const FLOATTYPE *const_iterator;
|
||||
|
||||
INLINE FLOATNAME(LVecBase3)();
|
||||
INLINE FLOATNAME(LVecBase3)(const FLOATNAME(LVecBase3) ©);
|
||||
INLINE FLOATNAME(LVecBase3) &operator = (const FLOATNAME(LVecBase3) ©);
|
||||
INLINE FLOATNAME(LVecBase3) &operator = (FLOATTYPE fill_value);
|
||||
INLINE FLOATNAME(LVecBase3)(FLOATTYPE fill_value);
|
||||
INLINE FLOATNAME(LVecBase3)(FLOATTYPE x, FLOATTYPE y, FLOATTYPE z);
|
||||
INLINE_LINMATH FLOATNAME(LVecBase3)();
|
||||
INLINE_LINMATH FLOATNAME(LVecBase3)(const FLOATNAME(LVecBase3) ©);
|
||||
INLINE_LINMATH FLOATNAME(LVecBase3) &operator = (const FLOATNAME(LVecBase3) ©);
|
||||
INLINE_LINMATH FLOATNAME(LVecBase3) &operator = (FLOATTYPE fill_value);
|
||||
INLINE_LINMATH FLOATNAME(LVecBase3)(FLOATTYPE fill_value);
|
||||
INLINE_LINMATH FLOATNAME(LVecBase3)(FLOATTYPE x, FLOATTYPE y, FLOATTYPE z);
|
||||
|
||||
INLINE static const FLOATNAME(LVecBase3) &zero();
|
||||
INLINE static const FLOATNAME(LVecBase3) &unit_x();
|
||||
INLINE static const FLOATNAME(LVecBase3) &unit_y();
|
||||
INLINE static const FLOATNAME(LVecBase3) &unit_z();
|
||||
INLINE_LINMATH static const FLOATNAME(LVecBase3) &zero();
|
||||
INLINE_LINMATH static const FLOATNAME(LVecBase3) &unit_x();
|
||||
INLINE_LINMATH static const FLOATNAME(LVecBase3) &unit_y();
|
||||
INLINE_LINMATH static const FLOATNAME(LVecBase3) &unit_z();
|
||||
|
||||
INLINE ~FLOATNAME(LVecBase3)();
|
||||
INLINE_LINMATH ~FLOATNAME(LVecBase3)();
|
||||
|
||||
INLINE FLOATTYPE operator [](int i) const;
|
||||
INLINE FLOATTYPE &operator [](int i);
|
||||
INLINE_LINMATH FLOATTYPE operator [](int i) const;
|
||||
INLINE_LINMATH FLOATTYPE &operator [](int i);
|
||||
|
||||
INLINE bool is_nan() const;
|
||||
INLINE_LINMATH bool is_nan() const;
|
||||
|
||||
INLINE FLOATTYPE get_cell(int i) const;
|
||||
INLINE FLOATTYPE get_x() const;
|
||||
INLINE FLOATTYPE get_y() const;
|
||||
INLINE FLOATTYPE get_z() const;
|
||||
INLINE void set_cell(int i, FLOATTYPE value);
|
||||
INLINE void set_x(FLOATTYPE value);
|
||||
INLINE void set_y(FLOATTYPE value);
|
||||
INLINE void set_z(FLOATTYPE value);
|
||||
INLINE_LINMATH FLOATTYPE get_cell(int i) const;
|
||||
INLINE_LINMATH FLOATTYPE get_x() const;
|
||||
INLINE_LINMATH FLOATTYPE get_y() const;
|
||||
INLINE_LINMATH FLOATTYPE get_z() const;
|
||||
INLINE_LINMATH void set_cell(int i, FLOATTYPE value);
|
||||
INLINE_LINMATH void set_x(FLOATTYPE value);
|
||||
INLINE_LINMATH void set_y(FLOATTYPE value);
|
||||
INLINE_LINMATH void set_z(FLOATTYPE value);
|
||||
|
||||
INLINE const FLOATTYPE *get_data() const;
|
||||
INLINE int get_num_components() const;
|
||||
INLINE_LINMATH const FLOATTYPE *get_data() const;
|
||||
INLINE_LINMATH int get_num_components() const;
|
||||
|
||||
public:
|
||||
INLINE iterator begin();
|
||||
INLINE iterator end();
|
||||
INLINE_LINMATH iterator begin();
|
||||
INLINE_LINMATH iterator end();
|
||||
|
||||
INLINE const_iterator begin() const;
|
||||
INLINE const_iterator end() const;
|
||||
INLINE_LINMATH const_iterator begin() const;
|
||||
INLINE_LINMATH const_iterator end() const;
|
||||
|
||||
PUBLISHED:
|
||||
INLINE void fill(FLOATTYPE fill_value);
|
||||
INLINE void set(FLOATTYPE x, FLOATTYPE y, FLOATTYPE z);
|
||||
INLINE_LINMATH void fill(FLOATTYPE fill_value);
|
||||
INLINE_LINMATH void set(FLOATTYPE x, FLOATTYPE y, FLOATTYPE z);
|
||||
|
||||
INLINE FLOATTYPE dot(const FLOATNAME(LVecBase3) &other) const;
|
||||
INLINE FLOATNAME(LVecBase3) cross(const FLOATNAME(LVecBase3) &other) const;
|
||||
INLINE_LINMATH FLOATTYPE dot(const FLOATNAME(LVecBase3) &other) const;
|
||||
INLINE_LINMATH FLOATNAME(LVecBase3) cross(const FLOATNAME(LVecBase3) &other) const;
|
||||
|
||||
INLINE bool operator < (const FLOATNAME(LVecBase3) &other) const;
|
||||
INLINE bool operator == (const FLOATNAME(LVecBase3) &other) const;
|
||||
INLINE bool operator != (const FLOATNAME(LVecBase3) &other) const;
|
||||
INLINE_LINMATH bool operator < (const FLOATNAME(LVecBase3) &other) const;
|
||||
INLINE_LINMATH bool operator == (const FLOATNAME(LVecBase3) &other) const;
|
||||
INLINE_LINMATH bool operator != (const FLOATNAME(LVecBase3) &other) const;
|
||||
|
||||
INLINE int compare_to(const FLOATNAME(LVecBase3) &other) const;
|
||||
INLINE int compare_to(const FLOATNAME(LVecBase3) &other,
|
||||
INLINE_LINMATH int compare_to(const FLOATNAME(LVecBase3) &other) const;
|
||||
INLINE_LINMATH int compare_to(const FLOATNAME(LVecBase3) &other,
|
||||
FLOATTYPE threshold) const;
|
||||
|
||||
INLINE FLOATNAME(LVecBase3) operator - () const;
|
||||
INLINE_LINMATH FLOATNAME(LVecBase3) operator - () const;
|
||||
|
||||
INLINE FLOATNAME(LVecBase3)
|
||||
INLINE_LINMATH FLOATNAME(LVecBase3)
|
||||
operator + (const FLOATNAME(LVecBase3) &other) const;
|
||||
INLINE FLOATNAME(LVecBase3)
|
||||
INLINE_LINMATH FLOATNAME(LVecBase3)
|
||||
operator - (const FLOATNAME(LVecBase3) &other) const;
|
||||
|
||||
INLINE FLOATNAME(LVecBase3) operator * (FLOATTYPE scalar) const;
|
||||
INLINE FLOATNAME(LVecBase3) operator / (FLOATTYPE scalar) const;
|
||||
INLINE_LINMATH FLOATNAME(LVecBase3) operator * (FLOATTYPE scalar) const;
|
||||
INLINE_LINMATH FLOATNAME(LVecBase3) operator / (FLOATTYPE scalar) const;
|
||||
|
||||
INLINE void operator += (const FLOATNAME(LVecBase3) &other);
|
||||
INLINE void operator -= (const FLOATNAME(LVecBase3) &other);
|
||||
INLINE_LINMATH void operator += (const FLOATNAME(LVecBase3) &other);
|
||||
INLINE_LINMATH void operator -= (const FLOATNAME(LVecBase3) &other);
|
||||
|
||||
INLINE void operator *= (FLOATTYPE scalar);
|
||||
INLINE void operator /= (FLOATTYPE scalar);
|
||||
INLINE_LINMATH void operator *= (FLOATTYPE scalar);
|
||||
INLINE_LINMATH void operator /= (FLOATTYPE scalar);
|
||||
|
||||
INLINE void cross_into(const FLOATNAME(LVecBase3) &other);
|
||||
INLINE_LINMATH void cross_into(const FLOATNAME(LVecBase3) &other);
|
||||
|
||||
INLINE bool almost_equal(const FLOATNAME(LVecBase3) &other,
|
||||
INLINE_LINMATH bool almost_equal(const FLOATNAME(LVecBase3) &other,
|
||||
FLOATTYPE threshold) const;
|
||||
INLINE bool almost_equal(const FLOATNAME(LVecBase3) &other) const;
|
||||
INLINE_LINMATH bool almost_equal(const FLOATNAME(LVecBase3) &other) const;
|
||||
|
||||
INLINE void output(ostream &out) const;
|
||||
INLINE_LINMATH void output(ostream &out) const;
|
||||
|
||||
protected:
|
||||
FLOATTYPE _data[3];
|
||||
public:
|
||||
union {
|
||||
FLOATTYPE data[3];
|
||||
struct {FLOATTYPE _0, _1, _2;} v;
|
||||
} _v;
|
||||
|
||||
private:
|
||||
static const FLOATNAME(LVecBase3) _zero;
|
||||
|
|
@ -100,8 +103,8 @@ private:
|
|||
static const FLOATNAME(LVecBase3) _unit_z;
|
||||
|
||||
public:
|
||||
INLINE void write_datagram(Datagram &destination) const;
|
||||
INLINE void read_datagram(DatagramIterator &source);
|
||||
INLINE_LINMATH void write_datagram(Datagram &destination) const;
|
||||
INLINE_LINMATH void read_datagram(DatagramIterator &source);
|
||||
|
||||
public:
|
||||
static TypeHandle get_class_type() {
|
||||
|
|
@ -114,7 +117,7 @@ private:
|
|||
};
|
||||
|
||||
|
||||
INLINE ostream &operator << (ostream &out, const FLOATNAME(LVecBase3) &vec) {
|
||||
INLINE_LINMATH ostream &operator << (ostream &out, const FLOATNAME(LVecBase3) &vec) {
|
||||
vec.output(out);
|
||||
return out;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVecBase4)::
|
||||
INLINE_LINMATH FLOATNAME(LVecBase4)::
|
||||
FLOATNAME(LVecBase4)() {
|
||||
}
|
||||
|
||||
|
|
@ -18,9 +18,13 @@ FLOATNAME(LVecBase4)() {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVecBase4)::
|
||||
INLINE_LINMATH FLOATNAME(LVecBase4)::
|
||||
FLOATNAME(LVecBase4)(const FLOATNAME(LVecBase4) ©) {
|
||||
(*this) = copy;
|
||||
_v.v._0 = copy._v.v._0;
|
||||
_v.v._1 = copy._v.v._1;
|
||||
_v.v._2 = copy._v.v._2;
|
||||
_v.v._3 = copy._v.v._3;
|
||||
// (*this) = copy;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -28,9 +32,13 @@ FLOATNAME(LVecBase4)(const FLOATNAME(LVecBase4) ©) {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVecBase4) &FLOATNAME(LVecBase4)::
|
||||
INLINE_LINMATH FLOATNAME(LVecBase4) &FLOATNAME(LVecBase4)::
|
||||
operator = (const FLOATNAME(LVecBase4) ©) {
|
||||
set(copy[0], copy[1], copy[2], copy[3]);
|
||||
_v.v._0 = copy._v.v._0;
|
||||
_v.v._1 = copy._v.v._1;
|
||||
_v.v._2 = copy._v.v._2;
|
||||
_v.v._3 = copy._v.v._3;
|
||||
// set(copy[0], copy[1], copy[2], copy[3]);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
|
@ -39,7 +47,7 @@ operator = (const FLOATNAME(LVecBase4) ©) {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVecBase4) &FLOATNAME(LVecBase4)::
|
||||
INLINE_LINMATH FLOATNAME(LVecBase4) &FLOATNAME(LVecBase4)::
|
||||
operator = (FLOATTYPE fill_value) {
|
||||
fill(fill_value);
|
||||
return *this;
|
||||
|
|
@ -50,7 +58,7 @@ operator = (FLOATTYPE fill_value) {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVecBase4)::
|
||||
INLINE_LINMATH FLOATNAME(LVecBase4)::
|
||||
FLOATNAME(LVecBase4)(FLOATTYPE fill_value) {
|
||||
fill(fill_value);
|
||||
}
|
||||
|
|
@ -60,9 +68,13 @@ FLOATNAME(LVecBase4)(FLOATTYPE fill_value) {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVecBase4)::
|
||||
INLINE_LINMATH FLOATNAME(LVecBase4)::
|
||||
FLOATNAME(LVecBase4)(FLOATTYPE x, FLOATTYPE y, FLOATTYPE z, FLOATTYPE w) {
|
||||
set(x, y, z, w);
|
||||
_v.v._0 = x;
|
||||
_v.v._1 = y;
|
||||
_v.v._2 = z;
|
||||
_v.v._3 = w;
|
||||
// set(x, y, z, w);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -70,7 +82,7 @@ FLOATNAME(LVecBase4)(FLOATTYPE x, FLOATTYPE y, FLOATTYPE z, FLOATTYPE w) {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVecBase4)::
|
||||
INLINE_LINMATH FLOATNAME(LVecBase4)::
|
||||
~FLOATNAME(LVecBase4)() {
|
||||
}
|
||||
|
||||
|
|
@ -79,7 +91,7 @@ INLINE FLOATNAME(LVecBase4)::
|
|||
// Access: Public
|
||||
// Description: Returns a zero-length vector.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE const FLOATNAME(LVecBase4) &FLOATNAME(LVecBase4)::
|
||||
INLINE_LINMATH const FLOATNAME(LVecBase4) &FLOATNAME(LVecBase4)::
|
||||
zero() {
|
||||
return _zero;
|
||||
}
|
||||
|
|
@ -89,7 +101,7 @@ zero() {
|
|||
// Access: Public
|
||||
// Description: Returns a unit X vector.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE const FLOATNAME(LVecBase4) &FLOATNAME(LVecBase4)::
|
||||
INLINE_LINMATH const FLOATNAME(LVecBase4) &FLOATNAME(LVecBase4)::
|
||||
unit_x() {
|
||||
return _unit_x;
|
||||
}
|
||||
|
|
@ -99,7 +111,7 @@ unit_x() {
|
|||
// Access: Public
|
||||
// Description: Returns a unit Y vector.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE const FLOATNAME(LVecBase4) &FLOATNAME(LVecBase4)::
|
||||
INLINE_LINMATH const FLOATNAME(LVecBase4) &FLOATNAME(LVecBase4)::
|
||||
unit_y() {
|
||||
return _unit_y;
|
||||
}
|
||||
|
|
@ -109,7 +121,7 @@ unit_y() {
|
|||
// Access: Public
|
||||
// Description: Returns a unit Z vector.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE const FLOATNAME(LVecBase4) &FLOATNAME(LVecBase4)::
|
||||
INLINE_LINMATH const FLOATNAME(LVecBase4) &FLOATNAME(LVecBase4)::
|
||||
unit_z() {
|
||||
return _unit_z;
|
||||
}
|
||||
|
|
@ -119,7 +131,7 @@ unit_z() {
|
|||
// Access: Public
|
||||
// Description: Returns a unit W vector.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE const FLOATNAME(LVecBase4) &FLOATNAME(LVecBase4)::
|
||||
INLINE_LINMATH const FLOATNAME(LVecBase4) &FLOATNAME(LVecBase4)::
|
||||
unit_w() {
|
||||
return _unit_w;
|
||||
}
|
||||
|
|
@ -129,10 +141,10 @@ unit_w() {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATTYPE FLOATNAME(LVecBase4)::
|
||||
INLINE_LINMATH FLOATTYPE FLOATNAME(LVecBase4)::
|
||||
operator [](int i) const {
|
||||
// nassertr(i >= 0 && i < 4, 0);
|
||||
return _data[i];
|
||||
return _v.data[i];
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -140,10 +152,10 @@ operator [](int i) const {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATTYPE &FLOATNAME(LVecBase4)::
|
||||
INLINE_LINMATH FLOATTYPE &FLOATNAME(LVecBase4)::
|
||||
operator [](int i) {
|
||||
// nassertr(i >= 0 && i < 4, _data[0]);
|
||||
return _data[i];
|
||||
// nassertr(i >= 0 && i < 4, _v.v._0);
|
||||
return _v.data[i];
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -152,9 +164,9 @@ operator [](int i) {
|
|||
// Description: Returns true if any component of the vector is
|
||||
// not-a-number, false otherwise.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE bool FLOATNAME(LVecBase4)::
|
||||
INLINE_LINMATH bool FLOATNAME(LVecBase4)::
|
||||
is_nan() const {
|
||||
return cnan(_data[0]) || cnan(_data[1]) || cnan(_data[2]) || cnan(_data[3]);
|
||||
return cnan(_v.v._0) || cnan(_v.v._1) || cnan(_v.v._2) || cnan(_v.v._3);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -162,10 +174,10 @@ is_nan() const {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATTYPE FLOATNAME(LVecBase4)::
|
||||
INLINE_LINMATH FLOATTYPE FLOATNAME(LVecBase4)::
|
||||
get_cell(int i) const {
|
||||
// nassertr(i >= 0 && i < 4, 0);
|
||||
return _data[i];
|
||||
return _v.data[i];
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -173,9 +185,9 @@ get_cell(int i) const {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATTYPE FLOATNAME(LVecBase4)::
|
||||
INLINE_LINMATH FLOATTYPE FLOATNAME(LVecBase4)::
|
||||
get_x() const {
|
||||
return _data[0];
|
||||
return _v.v._0;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -183,9 +195,9 @@ get_x() const {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATTYPE FLOATNAME(LVecBase4)::
|
||||
INLINE_LINMATH FLOATTYPE FLOATNAME(LVecBase4)::
|
||||
get_y() const {
|
||||
return _data[1];
|
||||
return _v.v._1;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -193,9 +205,9 @@ get_y() const {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATTYPE FLOATNAME(LVecBase4)::
|
||||
INLINE_LINMATH FLOATTYPE FLOATNAME(LVecBase4)::
|
||||
get_z() const {
|
||||
return _data[2];
|
||||
return _v.v._2;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -203,9 +215,9 @@ get_z() const {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATTYPE FLOATNAME(LVecBase4)::
|
||||
INLINE_LINMATH FLOATTYPE FLOATNAME(LVecBase4)::
|
||||
get_w() const {
|
||||
return _data[3];
|
||||
return _v.v._3;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -213,10 +225,10 @@ get_w() const {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void FLOATNAME(LVecBase4)::
|
||||
INLINE_LINMATH void FLOATNAME(LVecBase4)::
|
||||
set_cell(int i, FLOATTYPE value) {
|
||||
// nassertv(i >= 0 && i < 4);
|
||||
_data[i] = value;
|
||||
_v.data[i] = value;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -224,9 +236,9 @@ set_cell(int i, FLOATTYPE value) {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void FLOATNAME(LVecBase4)::
|
||||
INLINE_LINMATH void FLOATNAME(LVecBase4)::
|
||||
set_x(FLOATTYPE value) {
|
||||
_data[0] = value;
|
||||
_v.v._0 = value;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -234,9 +246,9 @@ set_x(FLOATTYPE value) {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void FLOATNAME(LVecBase4)::
|
||||
INLINE_LINMATH void FLOATNAME(LVecBase4)::
|
||||
set_y(FLOATTYPE value) {
|
||||
_data[1] = value;
|
||||
_v.v._1 = value;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -244,9 +256,9 @@ set_y(FLOATTYPE value) {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void FLOATNAME(LVecBase4)::
|
||||
INLINE_LINMATH void FLOATNAME(LVecBase4)::
|
||||
set_z(FLOATTYPE value) {
|
||||
_data[2] = value;
|
||||
_v.v._2 = value;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -254,9 +266,9 @@ set_z(FLOATTYPE value) {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void FLOATNAME(LVecBase4)::
|
||||
INLINE_LINMATH void FLOATNAME(LVecBase4)::
|
||||
set_w(FLOATTYPE value) {
|
||||
_data[3] = value;
|
||||
_v.v._3 = value;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -266,9 +278,9 @@ set_w(FLOATTYPE value) {
|
|||
// elements in the vector. The remaining elements
|
||||
// occupy the next positions consecutively in memory.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE const FLOATTYPE *FLOATNAME(LVecBase4)::
|
||||
INLINE_LINMATH const FLOATTYPE *FLOATNAME(LVecBase4)::
|
||||
get_data() const {
|
||||
return _data;
|
||||
return _v.data;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -276,7 +288,7 @@ get_data() const {
|
|||
// Access: Public
|
||||
// Description: Returns the number of elements in the vector, four.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE int FLOATNAME(LVecBase4)::
|
||||
INLINE_LINMATH int FLOATNAME(LVecBase4)::
|
||||
get_num_components() const {
|
||||
return 4;
|
||||
}
|
||||
|
|
@ -287,9 +299,9 @@ get_num_components() const {
|
|||
// Description: Returns an iterator that may be used to traverse the
|
||||
// elements of the matrix, STL-style.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVecBase4)::iterator FLOATNAME(LVecBase4)::
|
||||
INLINE_LINMATH FLOATNAME(LVecBase4)::iterator FLOATNAME(LVecBase4)::
|
||||
begin() {
|
||||
return _data;
|
||||
return _v.data;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -298,7 +310,7 @@ begin() {
|
|||
// Description: Returns an iterator that may be used to traverse the
|
||||
// elements of the matrix, STL-style.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVecBase4)::iterator FLOATNAME(LVecBase4)::
|
||||
INLINE_LINMATH FLOATNAME(LVecBase4)::iterator FLOATNAME(LVecBase4)::
|
||||
end() {
|
||||
return begin() + get_num_components();
|
||||
}
|
||||
|
|
@ -309,9 +321,9 @@ end() {
|
|||
// Description: Returns an iterator that may be used to traverse the
|
||||
// elements of the matrix, STL-style.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVecBase4)::const_iterator FLOATNAME(LVecBase4)::
|
||||
INLINE_LINMATH FLOATNAME(LVecBase4)::const_iterator FLOATNAME(LVecBase4)::
|
||||
begin() const {
|
||||
return _data;
|
||||
return _v.data;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -320,7 +332,7 @@ begin() const {
|
|||
// Description: Returns an iterator that may be used to traverse the
|
||||
// elements of the matrix, STL-style.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVecBase4)::const_iterator FLOATNAME(LVecBase4)::
|
||||
INLINE_LINMATH FLOATNAME(LVecBase4)::const_iterator FLOATNAME(LVecBase4)::
|
||||
end() const {
|
||||
return begin() + get_num_components();
|
||||
}
|
||||
|
|
@ -332,12 +344,12 @@ end() const {
|
|||
// fill_value. This is particularly useful for
|
||||
// initializing to zero.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void FLOATNAME(LVecBase4)::
|
||||
INLINE_LINMATH void FLOATNAME(LVecBase4)::
|
||||
fill(FLOATTYPE fill_value) {
|
||||
_data[0] = fill_value;
|
||||
_data[1] = fill_value;
|
||||
_data[2] = fill_value;
|
||||
_data[3] = fill_value;
|
||||
_v.v._0 = fill_value;
|
||||
_v.v._1 = fill_value;
|
||||
_v.v._2 = fill_value;
|
||||
_v.v._3 = fill_value;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -345,12 +357,12 @@ fill(FLOATTYPE fill_value) {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void FLOATNAME(LVecBase4)::
|
||||
INLINE_LINMATH void FLOATNAME(LVecBase4)::
|
||||
set(FLOATTYPE x, FLOATTYPE y, FLOATTYPE z, FLOATTYPE w) {
|
||||
_data[0] = x;
|
||||
_data[1] = y;
|
||||
_data[2] = z;
|
||||
_data[3] = w;
|
||||
_v.v._0 = x;
|
||||
_v.v._1 = y;
|
||||
_v.v._2 = z;
|
||||
_v.v._3 = w;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -358,11 +370,11 @@ set(FLOATTYPE x, FLOATTYPE y, FLOATTYPE z, FLOATTYPE w) {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATTYPE FLOATNAME(LVecBase4)::
|
||||
INLINE_LINMATH FLOATTYPE FLOATNAME(LVecBase4)::
|
||||
dot(const FLOATNAME(LVecBase4) &other) const {
|
||||
return
|
||||
_data[0] * other[0] + _data[1] * other[1] +
|
||||
_data[2] * other[2] + _data[3] * other[3];
|
||||
_v.v._0 * other._v.v._0 + _v.v._1 * other._v.v._1 +
|
||||
_v.v._2 * other._v.v._2 + _v.v._3 * other._v.v._3;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -374,7 +386,7 @@ dot(const FLOATNAME(LVecBase4) &other) const {
|
|||
// especially in an STL container. Also see
|
||||
// compare_to().
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE bool FLOATNAME(LVecBase4)::
|
||||
INLINE_LINMATH bool FLOATNAME(LVecBase4)::
|
||||
operator < (const FLOATNAME(LVecBase4) &other) const {
|
||||
return (compare_to(other) < 0);
|
||||
}
|
||||
|
|
@ -384,12 +396,12 @@ operator < (const FLOATNAME(LVecBase4) &other) const {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE bool FLOATNAME(LVecBase4)::
|
||||
INLINE_LINMATH bool FLOATNAME(LVecBase4)::
|
||||
operator == (const FLOATNAME(LVecBase4) &other) const {
|
||||
return (_data[0] == other[0] &&
|
||||
_data[1] == other[1] &&
|
||||
_data[2] == other[2] &&
|
||||
_data[3] == other[3]);
|
||||
return (_v.v._0 == other._v.v._0 &&
|
||||
_v.v._1 == other._v.v._1 &&
|
||||
_v.v._2 == other._v.v._2 &&
|
||||
_v.v._3 == other._v.v._3);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -397,7 +409,7 @@ operator == (const FLOATNAME(LVecBase4) &other) const {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE bool FLOATNAME(LVecBase4)::
|
||||
INLINE_LINMATH bool FLOATNAME(LVecBase4)::
|
||||
operator != (const FLOATNAME(LVecBase4) &other) const {
|
||||
return !operator == (other);
|
||||
}
|
||||
|
|
@ -408,7 +420,7 @@ operator != (const FLOATNAME(LVecBase4) &other) const {
|
|||
// Description: This flavor of compare_to uses a default threshold
|
||||
// value based on the numeric type.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE int FLOATNAME(LVecBase4)::
|
||||
INLINE_LINMATH int FLOATNAME(LVecBase4)::
|
||||
compare_to(const FLOATNAME(LVecBase4) &other) const {
|
||||
return compare_to(other, NEARLY_ZERO(FLOATTYPE));
|
||||
}
|
||||
|
|
@ -422,19 +434,19 @@ compare_to(const FLOATNAME(LVecBase4) &other) const {
|
|||
// after, 0 if they are equivalent (within the indicated
|
||||
// tolerance).
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE int FLOATNAME(LVecBase4)::
|
||||
INLINE_LINMATH int FLOATNAME(LVecBase4)::
|
||||
compare_to(const FLOATNAME(LVecBase4) &other, FLOATTYPE threshold) const {
|
||||
if (!IS_THRESHOLD_EQUAL(_data[0], other[0], threshold)) {
|
||||
return (_data[0] < other[0]) ? -1 : 1;
|
||||
if (!IS_THRESHOLD_EQUAL(_v.v._0, other._v.v._0, threshold)) {
|
||||
return (_v.v._0 < other._v.v._0) ? -1 : 1;
|
||||
}
|
||||
if (!IS_THRESHOLD_EQUAL(_data[1], other[1], threshold)) {
|
||||
return (_data[1] < other[1]) ? -1 : 1;
|
||||
if (!IS_THRESHOLD_EQUAL(_v.v._1, other._v.v._1, threshold)) {
|
||||
return (_v.v._1 < other._v.v._1) ? -1 : 1;
|
||||
}
|
||||
if (!IS_THRESHOLD_EQUAL(_data[2], other[2], threshold)) {
|
||||
return (_data[2] < other[2]) ? -1 : 1;
|
||||
if (!IS_THRESHOLD_EQUAL(_v.v._2, other._v.v._2, threshold)) {
|
||||
return (_v.v._2 < other._v.v._2) ? -1 : 1;
|
||||
}
|
||||
if (!IS_THRESHOLD_EQUAL(_data[3], other[3], threshold)) {
|
||||
return (_data[3] < other[3]) ? -1 : 1;
|
||||
if (!IS_THRESHOLD_EQUAL(_v.v._3, other._v.v._3, threshold)) {
|
||||
return (_v.v._3 < other._v.v._3) ? -1 : 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -444,9 +456,9 @@ compare_to(const FLOATNAME(LVecBase4) &other, FLOATTYPE threshold) const {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVecBase4) FLOATNAME(LVecBase4)::
|
||||
INLINE_LINMATH FLOATNAME(LVecBase4) FLOATNAME(LVecBase4)::
|
||||
operator - () const {
|
||||
return FLOATNAME(LVecBase4)(-_data[0], -_data[1], -_data[2], -_data[3]);
|
||||
return FLOATNAME(LVecBase4)(-_v.v._0, -_v.v._1, -_v.v._2, -_v.v._3);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -454,12 +466,12 @@ operator - () const {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVecBase4) FLOATNAME(LVecBase4)::
|
||||
INLINE_LINMATH FLOATNAME(LVecBase4) FLOATNAME(LVecBase4)::
|
||||
operator + (const FLOATNAME(LVecBase4) &other) const {
|
||||
return FLOATNAME(LVecBase4)(_data[0] + other[0],
|
||||
_data[1] + other[1],
|
||||
_data[2] + other[2],
|
||||
_data[3] + other[3]);
|
||||
return FLOATNAME(LVecBase4)(_v.v._0 + other._v.v._0,
|
||||
_v.v._1 + other._v.v._1,
|
||||
_v.v._2 + other._v.v._2,
|
||||
_v.v._3 + other._v.v._3);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -467,12 +479,12 @@ operator + (const FLOATNAME(LVecBase4) &other) const {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVecBase4) FLOATNAME(LVecBase4)::
|
||||
INLINE_LINMATH FLOATNAME(LVecBase4) FLOATNAME(LVecBase4)::
|
||||
operator - (const FLOATNAME(LVecBase4) &other) const {
|
||||
return FLOATNAME(LVecBase4)(_data[0] - other[0],
|
||||
_data[1] - other[1],
|
||||
_data[2] - other[2],
|
||||
_data[3] - other[3]);
|
||||
return FLOATNAME(LVecBase4)(_v.v._0 - other._v.v._0,
|
||||
_v.v._1 - other._v.v._1,
|
||||
_v.v._2 - other._v.v._2,
|
||||
_v.v._3 - other._v.v._3);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -480,12 +492,12 @@ operator - (const FLOATNAME(LVecBase4) &other) const {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVecBase4) FLOATNAME(LVecBase4)::
|
||||
INLINE_LINMATH FLOATNAME(LVecBase4) FLOATNAME(LVecBase4)::
|
||||
operator * (FLOATTYPE scalar) const {
|
||||
return FLOATNAME(LVecBase4)(_data[0] * scalar,
|
||||
_data[1] * scalar,
|
||||
_data[2] * scalar,
|
||||
_data[3] * scalar);
|
||||
return FLOATNAME(LVecBase4)(_v.v._0 * scalar,
|
||||
_v.v._1 * scalar,
|
||||
_v.v._2 * scalar,
|
||||
_v.v._3 * scalar);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -493,12 +505,13 @@ operator * (FLOATTYPE scalar) const {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVecBase4) FLOATNAME(LVecBase4)::
|
||||
INLINE_LINMATH FLOATNAME(LVecBase4) FLOATNAME(LVecBase4)::
|
||||
operator / (FLOATTYPE scalar) const {
|
||||
return FLOATNAME(LVecBase4)(_data[0] / scalar,
|
||||
_data[1] / scalar,
|
||||
_data[2] / scalar,
|
||||
_data[3] / scalar);
|
||||
FLOATTYPE recip_scalar = 1.0/scalar;
|
||||
return FLOATNAME(LVecBase4)(_v.v._0 * recip_scalar,
|
||||
_v.v._1 * recip_scalar,
|
||||
_v.v._2 * recip_scalar,
|
||||
_v.v._3 * recip_scalar);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -506,12 +519,12 @@ operator / (FLOATTYPE scalar) const {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void FLOATNAME(LVecBase4)::
|
||||
INLINE_LINMATH void FLOATNAME(LVecBase4)::
|
||||
operator += (const FLOATNAME(LVecBase4) &other) {
|
||||
_data[0] += other[0];
|
||||
_data[1] += other[1];
|
||||
_data[2] += other[2];
|
||||
_data[3] += other[3];
|
||||
_v.v._0 += other._v.v._0;
|
||||
_v.v._1 += other._v.v._1;
|
||||
_v.v._2 += other._v.v._2;
|
||||
_v.v._3 += other._v.v._3;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -519,12 +532,12 @@ operator += (const FLOATNAME(LVecBase4) &other) {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void FLOATNAME(LVecBase4)::
|
||||
INLINE_LINMATH void FLOATNAME(LVecBase4)::
|
||||
operator -= (const FLOATNAME(LVecBase4) &other) {
|
||||
_data[0] -= other[0];
|
||||
_data[1] -= other[1];
|
||||
_data[2] -= other[2];
|
||||
_data[3] -= other[3];
|
||||
_v.v._0 -= other._v.v._0;
|
||||
_v.v._1 -= other._v.v._1;
|
||||
_v.v._2 -= other._v.v._2;
|
||||
_v.v._3 -= other._v.v._3;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -532,12 +545,12 @@ operator -= (const FLOATNAME(LVecBase4) &other) {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void FLOATNAME(LVecBase4)::
|
||||
INLINE_LINMATH void FLOATNAME(LVecBase4)::
|
||||
operator *= (FLOATTYPE scalar) {
|
||||
_data[0] *= scalar;
|
||||
_data[1] *= scalar;
|
||||
_data[2] *= scalar;
|
||||
_data[3] *= scalar;
|
||||
_v.v._0 *= scalar;
|
||||
_v.v._1 *= scalar;
|
||||
_v.v._2 *= scalar;
|
||||
_v.v._3 *= scalar;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -545,12 +558,13 @@ operator *= (FLOATTYPE scalar) {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void FLOATNAME(LVecBase4)::
|
||||
INLINE_LINMATH void FLOATNAME(LVecBase4)::
|
||||
operator /= (FLOATTYPE scalar) {
|
||||
_data[0] /= scalar;
|
||||
_data[1] /= scalar;
|
||||
_data[2] /= scalar;
|
||||
_data[3] /= scalar;
|
||||
FLOATTYPE recip_scalar = 1.0/scalar;
|
||||
_v.v._0 *= recip_scalar;
|
||||
_v.v._1 *= recip_scalar;
|
||||
_v.v._2 *= recip_scalar;
|
||||
_v.v._3 *= recip_scalar;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -559,12 +573,12 @@ operator /= (FLOATTYPE scalar) {
|
|||
// Description: Returns true if two vectors are memberwise equal
|
||||
// within a specified tolerance.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE bool FLOATNAME(LVecBase4)::
|
||||
INLINE_LINMATH bool FLOATNAME(LVecBase4)::
|
||||
almost_equal(const FLOATNAME(LVecBase4) &other, FLOATTYPE threshold) const {
|
||||
return (IS_THRESHOLD_EQUAL(_data[0], other[0], threshold) &&
|
||||
IS_THRESHOLD_EQUAL(_data[1], other[1], threshold) &&
|
||||
IS_THRESHOLD_EQUAL(_data[2], other[2], threshold) &&
|
||||
IS_THRESHOLD_EQUAL(_data[3], other[3], threshold));
|
||||
return (IS_THRESHOLD_EQUAL(_v.v._0, other._v.v._0, threshold) &&
|
||||
IS_THRESHOLD_EQUAL(_v.v._1, other._v.v._1, threshold) &&
|
||||
IS_THRESHOLD_EQUAL(_v.v._2, other._v.v._2, threshold) &&
|
||||
IS_THRESHOLD_EQUAL(_v.v._3, other._v.v._3, threshold));
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -573,7 +587,7 @@ almost_equal(const FLOATNAME(LVecBase4) &other, FLOATTYPE threshold) const {
|
|||
// Description: Returns true if two vectors are memberwise equal
|
||||
// within a default tolerance based on the numeric type.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE bool FLOATNAME(LVecBase4)::
|
||||
INLINE_LINMATH bool FLOATNAME(LVecBase4)::
|
||||
almost_equal(const FLOATNAME(LVecBase4) &other) const {
|
||||
return almost_equal(other, NEARLY_ZERO(FLOATTYPE));
|
||||
}
|
||||
|
|
@ -583,12 +597,12 @@ almost_equal(const FLOATNAME(LVecBase4) &other) const {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void FLOATNAME(LVecBase4)::
|
||||
INLINE_LINMATH void FLOATNAME(LVecBase4)::
|
||||
output(ostream &out) const {
|
||||
out << MAYBE_ZERO(_data[0]) << " "
|
||||
<< MAYBE_ZERO(_data[1]) << " "
|
||||
<< MAYBE_ZERO(_data[2]) << " "
|
||||
<< MAYBE_ZERO(_data[3]);
|
||||
out << MAYBE_ZERO(_v.v._0) << " "
|
||||
<< MAYBE_ZERO(_v.v._1) << " "
|
||||
<< MAYBE_ZERO(_v.v._2) << " "
|
||||
<< MAYBE_ZERO(_v.v._3);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -596,12 +610,12 @@ output(ostream &out) const {
|
|||
// Access: Public
|
||||
// Description: Function to write itself into a datagram
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void FLOATNAME(LVecBase4)::
|
||||
INLINE_LINMATH void FLOATNAME(LVecBase4)::
|
||||
write_datagram(Datagram &destination) const {
|
||||
destination.add_float32(_data[0]);
|
||||
destination.add_float32(_data[1]);
|
||||
destination.add_float32(_data[2]);
|
||||
destination.add_float32(_data[3]);
|
||||
destination.add_float32(_v.v._0);
|
||||
destination.add_float32(_v.v._1);
|
||||
destination.add_float32(_v.v._2);
|
||||
destination.add_float32(_v.v._3);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -609,10 +623,10 @@ write_datagram(Datagram &destination) const {
|
|||
// Access: Public
|
||||
// Description: Function to read itself from a datagramIterator
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void FLOATNAME(LVecBase4)::
|
||||
INLINE_LINMATH void FLOATNAME(LVecBase4)::
|
||||
read_datagram(DatagramIterator &source) {
|
||||
_data[0] = source.get_float32();
|
||||
_data[1] = source.get_float32();
|
||||
_data[2] = source.get_float32();
|
||||
_data[3] = source.get_float32();
|
||||
_v.v._0 = source.get_float32();
|
||||
_v.v._1 = source.get_float32();
|
||||
_v.v._2 = source.get_float32();
|
||||
_v.v._3 = source.get_float32();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,85 +13,89 @@ PUBLISHED:
|
|||
typedef const FLOATTYPE *iterator;
|
||||
typedef const FLOATTYPE *const_iterator;
|
||||
|
||||
INLINE FLOATNAME(LVecBase4)();
|
||||
INLINE FLOATNAME(LVecBase4)(const FLOATNAME(LVecBase4) ©);
|
||||
INLINE FLOATNAME(LVecBase4) &operator = (const FLOATNAME(LVecBase4) ©);
|
||||
INLINE FLOATNAME(LVecBase4) &operator = (FLOATTYPE fill_value);
|
||||
INLINE FLOATNAME(LVecBase4)(FLOATTYPE fill_value);
|
||||
INLINE FLOATNAME(LVecBase4)(FLOATTYPE x, FLOATTYPE y, FLOATTYPE z, FLOATTYPE w);
|
||||
INLINE_LINMATH FLOATNAME(LVecBase4)();
|
||||
INLINE_LINMATH FLOATNAME(LVecBase4)(const FLOATNAME(LVecBase4) ©);
|
||||
INLINE_LINMATH FLOATNAME(LVecBase4) &operator = (const FLOATNAME(LVecBase4) ©);
|
||||
INLINE_LINMATH FLOATNAME(LVecBase4) &operator = (FLOATTYPE fill_value);
|
||||
INLINE_LINMATH FLOATNAME(LVecBase4)(FLOATTYPE fill_value);
|
||||
INLINE_LINMATH FLOATNAME(LVecBase4)(FLOATTYPE x, FLOATTYPE y, FLOATTYPE z, FLOATTYPE w);
|
||||
|
||||
INLINE static const FLOATNAME(LVecBase4) &zero();
|
||||
INLINE static const FLOATNAME(LVecBase4) &unit_x();
|
||||
INLINE static const FLOATNAME(LVecBase4) &unit_y();
|
||||
INLINE static const FLOATNAME(LVecBase4) &unit_z();
|
||||
INLINE static const FLOATNAME(LVecBase4) &unit_w();
|
||||
INLINE_LINMATH static const FLOATNAME(LVecBase4) &zero();
|
||||
INLINE_LINMATH static const FLOATNAME(LVecBase4) &unit_x();
|
||||
INLINE_LINMATH static const FLOATNAME(LVecBase4) &unit_y();
|
||||
INLINE_LINMATH static const FLOATNAME(LVecBase4) &unit_z();
|
||||
INLINE_LINMATH static const FLOATNAME(LVecBase4) &unit_w();
|
||||
|
||||
INLINE ~FLOATNAME(LVecBase4)();
|
||||
INLINE_LINMATH ~FLOATNAME(LVecBase4)();
|
||||
|
||||
INLINE FLOATTYPE operator [](int i) const;
|
||||
INLINE FLOATTYPE &operator [](int i);
|
||||
INLINE_LINMATH FLOATTYPE operator [](int i) const;
|
||||
INLINE_LINMATH FLOATTYPE &operator [](int i);
|
||||
|
||||
INLINE bool is_nan() const;
|
||||
INLINE_LINMATH bool is_nan() const;
|
||||
|
||||
INLINE FLOATTYPE get_cell(int i) const;
|
||||
INLINE FLOATTYPE get_x() const;
|
||||
INLINE FLOATTYPE get_y() const;
|
||||
INLINE FLOATTYPE get_z() const;
|
||||
INLINE FLOATTYPE get_w() const;
|
||||
INLINE void set_cell(int i, FLOATTYPE value);
|
||||
INLINE void set_x(FLOATTYPE value);
|
||||
INLINE void set_y(FLOATTYPE value);
|
||||
INLINE void set_z(FLOATTYPE value);
|
||||
INLINE void set_w(FLOATTYPE value);
|
||||
INLINE_LINMATH FLOATTYPE get_cell(int i) const;
|
||||
INLINE_LINMATH FLOATTYPE get_x() const;
|
||||
INLINE_LINMATH FLOATTYPE get_y() const;
|
||||
INLINE_LINMATH FLOATTYPE get_z() const;
|
||||
INLINE_LINMATH FLOATTYPE get_w() const;
|
||||
INLINE_LINMATH void set_cell(int i, FLOATTYPE value);
|
||||
INLINE_LINMATH void set_x(FLOATTYPE value);
|
||||
INLINE_LINMATH void set_y(FLOATTYPE value);
|
||||
INLINE_LINMATH void set_z(FLOATTYPE value);
|
||||
INLINE_LINMATH void set_w(FLOATTYPE value);
|
||||
|
||||
INLINE const FLOATTYPE *get_data() const;
|
||||
INLINE int get_num_components() const;
|
||||
INLINE_LINMATH const FLOATTYPE *get_data() const;
|
||||
INLINE_LINMATH int get_num_components() const;
|
||||
|
||||
public:
|
||||
INLINE iterator begin();
|
||||
INLINE iterator end();
|
||||
INLINE_LINMATH iterator begin();
|
||||
INLINE_LINMATH iterator end();
|
||||
|
||||
INLINE const_iterator begin() const;
|
||||
INLINE const_iterator end() const;
|
||||
INLINE_LINMATH const_iterator begin() const;
|
||||
INLINE_LINMATH const_iterator end() const;
|
||||
|
||||
PUBLISHED:
|
||||
INLINE void fill(FLOATTYPE fill_value);
|
||||
INLINE void set(FLOATTYPE x, FLOATTYPE y, FLOATTYPE z, FLOATTYPE w);
|
||||
INLINE_LINMATH void fill(FLOATTYPE fill_value);
|
||||
INLINE_LINMATH void set(FLOATTYPE x, FLOATTYPE y, FLOATTYPE z, FLOATTYPE w);
|
||||
|
||||
INLINE FLOATTYPE dot(const FLOATNAME(LVecBase4) &other) const;
|
||||
INLINE_LINMATH FLOATTYPE dot(const FLOATNAME(LVecBase4) &other) const;
|
||||
|
||||
INLINE bool operator < (const FLOATNAME(LVecBase4) &other) const;
|
||||
INLINE bool operator == (const FLOATNAME(LVecBase4) &other) const;
|
||||
INLINE bool operator != (const FLOATNAME(LVecBase4) &other) const;
|
||||
INLINE_LINMATH bool operator < (const FLOATNAME(LVecBase4) &other) const;
|
||||
INLINE_LINMATH bool operator == (const FLOATNAME(LVecBase4) &other) const;
|
||||
INLINE_LINMATH bool operator != (const FLOATNAME(LVecBase4) &other) const;
|
||||
|
||||
INLINE int compare_to(const FLOATNAME(LVecBase4) &other) const;
|
||||
INLINE int compare_to(const FLOATNAME(LVecBase4) &other,
|
||||
INLINE_LINMATH int compare_to(const FLOATNAME(LVecBase4) &other) const;
|
||||
INLINE_LINMATH int compare_to(const FLOATNAME(LVecBase4) &other,
|
||||
FLOATTYPE threshold) const;
|
||||
|
||||
INLINE FLOATNAME(LVecBase4) operator - () const;
|
||||
INLINE_LINMATH FLOATNAME(LVecBase4) operator - () const;
|
||||
|
||||
INLINE FLOATNAME(LVecBase4)
|
||||
INLINE_LINMATH FLOATNAME(LVecBase4)
|
||||
operator + (const FLOATNAME(LVecBase4) &other) const;
|
||||
INLINE FLOATNAME(LVecBase4)
|
||||
INLINE_LINMATH FLOATNAME(LVecBase4)
|
||||
operator - (const FLOATNAME(LVecBase4) &other) const;
|
||||
|
||||
INLINE FLOATNAME(LVecBase4) operator * (FLOATTYPE scalar) const;
|
||||
INLINE FLOATNAME(LVecBase4) operator / (FLOATTYPE scalar) const;
|
||||
INLINE_LINMATH FLOATNAME(LVecBase4) operator * (FLOATTYPE scalar) const;
|
||||
INLINE_LINMATH FLOATNAME(LVecBase4) operator / (FLOATTYPE scalar) const;
|
||||
|
||||
INLINE void operator += (const FLOATNAME(LVecBase4) &other);
|
||||
INLINE void operator -= (const FLOATNAME(LVecBase4) &other);
|
||||
INLINE_LINMATH void operator += (const FLOATNAME(LVecBase4) &other);
|
||||
INLINE_LINMATH void operator -= (const FLOATNAME(LVecBase4) &other);
|
||||
|
||||
INLINE void operator *= (FLOATTYPE scalar);
|
||||
INLINE void operator /= (FLOATTYPE scalar);
|
||||
INLINE_LINMATH void operator *= (FLOATTYPE scalar);
|
||||
INLINE_LINMATH void operator /= (FLOATTYPE scalar);
|
||||
|
||||
INLINE bool almost_equal(const FLOATNAME(LVecBase4) &other,
|
||||
INLINE_LINMATH bool almost_equal(const FLOATNAME(LVecBase4) &other,
|
||||
FLOATTYPE threshold) const;
|
||||
INLINE bool almost_equal(const FLOATNAME(LVecBase4) &other) const;
|
||||
INLINE_LINMATH bool almost_equal(const FLOATNAME(LVecBase4) &other) const;
|
||||
|
||||
INLINE void output(ostream &out) const;
|
||||
INLINE_LINMATH void output(ostream &out) const;
|
||||
|
||||
protected:
|
||||
FLOATTYPE _data[4];
|
||||
public:
|
||||
|
||||
union {
|
||||
FLOATTYPE data[4];
|
||||
struct {FLOATTYPE _0, _1, _2, _3;} v;
|
||||
} _v;
|
||||
|
||||
private:
|
||||
static const FLOATNAME(LVecBase4) _zero;
|
||||
|
|
@ -101,8 +105,8 @@ private:
|
|||
static const FLOATNAME(LVecBase4) _unit_w;
|
||||
|
||||
public:
|
||||
INLINE void write_datagram(Datagram &destination) const;
|
||||
INLINE void read_datagram(DatagramIterator &source);
|
||||
INLINE_LINMATH void write_datagram(Datagram &destination) const;
|
||||
INLINE_LINMATH void read_datagram(DatagramIterator &source);
|
||||
|
||||
public:
|
||||
static TypeHandle get_class_type() {
|
||||
|
|
@ -114,7 +118,7 @@ private:
|
|||
static TypeHandle _type_handle;
|
||||
};
|
||||
|
||||
INLINE ostream &operator << (ostream &out, const FLOATNAME(LVecBase4) &vec) {
|
||||
INLINE_LINMATH ostream &operator << (ostream &out, const FLOATNAME(LVecBase4) &vec) {
|
||||
vec.output(out);
|
||||
return out;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVector2)::
|
||||
INLINE_LINMATH FLOATNAME(LVector2)::
|
||||
FLOATNAME(LVector2)() {
|
||||
}
|
||||
|
||||
|
|
@ -17,7 +17,7 @@ FLOATNAME(LVector2)() {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVector2)::
|
||||
INLINE_LINMATH FLOATNAME(LVector2)::
|
||||
FLOATNAME(LVector2)(const FLOATNAME(LVecBase2) ©) : FLOATNAME(LVecBase2)(copy) {
|
||||
}
|
||||
|
||||
|
|
@ -26,7 +26,7 @@ FLOATNAME(LVector2)(const FLOATNAME(LVecBase2) ©) : FLOATNAME(LVecBase2)(cop
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVector2) &FLOATNAME(LVector2)::
|
||||
INLINE_LINMATH FLOATNAME(LVector2) &FLOATNAME(LVector2)::
|
||||
operator = (const FLOATNAME(LVecBase2) ©) {
|
||||
FLOATNAME(LVecBase2)::operator = (copy);
|
||||
return *this;
|
||||
|
|
@ -37,7 +37,7 @@ operator = (const FLOATNAME(LVecBase2) ©) {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVector2) &FLOATNAME(LVector2)::
|
||||
INLINE_LINMATH FLOATNAME(LVector2) &FLOATNAME(LVector2)::
|
||||
operator = (FLOATTYPE fill_value) {
|
||||
FLOATNAME(LVecBase2)::operator = (fill_value);
|
||||
return *this;
|
||||
|
|
@ -48,7 +48,7 @@ operator = (FLOATTYPE fill_value) {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVector2)::
|
||||
INLINE_LINMATH FLOATNAME(LVector2)::
|
||||
FLOATNAME(LVector2)(FLOATTYPE fill_value) :
|
||||
FLOATNAME(LVecBase2)(fill_value)
|
||||
{
|
||||
|
|
@ -59,7 +59,7 @@ FLOATNAME(LVector2)(FLOATTYPE fill_value) :
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVector2)::
|
||||
INLINE_LINMATH FLOATNAME(LVector2)::
|
||||
FLOATNAME(LVector2)(FLOATTYPE x, FLOATTYPE y) :
|
||||
FLOATNAME(LVecBase2)(x, y)
|
||||
{
|
||||
|
|
@ -70,7 +70,7 @@ FLOATNAME(LVector2)(FLOATTYPE x, FLOATTYPE y) :
|
|||
// Access: Public
|
||||
// Description: Returns a zero-length vector.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE const FLOATNAME(LVector2) &FLOATNAME(LVector2)::
|
||||
INLINE_LINMATH const FLOATNAME(LVector2) &FLOATNAME(LVector2)::
|
||||
zero() {
|
||||
return (const FLOATNAME(LVector2) &)FLOATNAME(LVecBase2)::zero();
|
||||
}
|
||||
|
|
@ -80,7 +80,7 @@ zero() {
|
|||
// Access: Public
|
||||
// Description: Returns a unit X vector.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE const FLOATNAME(LVector2) &FLOATNAME(LVector2)::
|
||||
INLINE_LINMATH const FLOATNAME(LVector2) &FLOATNAME(LVector2)::
|
||||
unit_x() {
|
||||
return (const FLOATNAME(LVector2) &)FLOATNAME(LVecBase2)::unit_x();
|
||||
}
|
||||
|
|
@ -90,7 +90,7 @@ unit_x() {
|
|||
// Access: Public
|
||||
// Description: Returns a unit Y vector.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE const FLOATNAME(LVector2) &FLOATNAME(LVector2)::
|
||||
INLINE_LINMATH const FLOATNAME(LVector2) &FLOATNAME(LVector2)::
|
||||
unit_y() {
|
||||
return (const FLOATNAME(LVector2) &)FLOATNAME(LVecBase2)::unit_y();
|
||||
}
|
||||
|
|
@ -100,7 +100,7 @@ unit_y() {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVector2) FLOATNAME(LVector2)::
|
||||
INLINE_LINMATH FLOATNAME(LVector2) FLOATNAME(LVector2)::
|
||||
operator - () const {
|
||||
return FLOATNAME(LVecBase2)::operator - ();
|
||||
}
|
||||
|
|
@ -110,7 +110,7 @@ operator - () const {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVecBase2) FLOATNAME(LVector2)::
|
||||
INLINE_LINMATH FLOATNAME(LVecBase2) FLOATNAME(LVector2)::
|
||||
operator + (const FLOATNAME(LVecBase2) &other) const {
|
||||
return FLOATNAME(LVecBase2)::operator + (other);
|
||||
}
|
||||
|
|
@ -120,7 +120,7 @@ operator + (const FLOATNAME(LVecBase2) &other) const {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVector2) FLOATNAME(LVector2)::
|
||||
INLINE_LINMATH FLOATNAME(LVector2) FLOATNAME(LVector2)::
|
||||
operator + (const FLOATNAME(LVector2) &other) const {
|
||||
return FLOATNAME(LVecBase2)::operator + (other);
|
||||
}
|
||||
|
|
@ -130,7 +130,7 @@ operator + (const FLOATNAME(LVector2) &other) const {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVecBase2) FLOATNAME(LVector2)::
|
||||
INLINE_LINMATH FLOATNAME(LVecBase2) FLOATNAME(LVector2)::
|
||||
operator - (const FLOATNAME(LVecBase2) &other) const {
|
||||
return FLOATNAME(LVecBase2)::operator - (other);
|
||||
}
|
||||
|
|
@ -140,7 +140,7 @@ operator - (const FLOATNAME(LVecBase2) &other) const {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVector2) FLOATNAME(LVector2)::
|
||||
INLINE_LINMATH FLOATNAME(LVector2) FLOATNAME(LVector2)::
|
||||
operator - (const FLOATNAME(LVector2) &other) const {
|
||||
return FLOATNAME(LVecBase2)::operator - (other);
|
||||
}
|
||||
|
|
@ -151,7 +151,7 @@ operator - (const FLOATNAME(LVector2) &other) const {
|
|||
// Description: Returns the length of the vector, by the Pythagorean
|
||||
// theorem.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATTYPE FLOATNAME(LVector2)::
|
||||
INLINE_LINMATH FLOATTYPE FLOATNAME(LVector2)::
|
||||
length() const {
|
||||
return csqrt((*this).dot(*this));
|
||||
}
|
||||
|
|
@ -162,7 +162,7 @@ length() const {
|
|||
// Description: Returns the square of the vector's length, cheap and
|
||||
// easy.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATTYPE FLOATNAME(LVector2)::
|
||||
INLINE_LINMATH FLOATTYPE FLOATNAME(LVector2)::
|
||||
length_squared() const {
|
||||
return (*this).dot(*this);
|
||||
}
|
||||
|
|
@ -174,7 +174,7 @@ length_squared() const {
|
|||
// vector was normalized, false if it was a zero-length
|
||||
// vector.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE bool FLOATNAME(LVector2)::
|
||||
INLINE_LINMATH bool FLOATNAME(LVector2)::
|
||||
normalize() {
|
||||
FLOATTYPE l2 = length_squared();
|
||||
if (l2 == (FLOATTYPE)0.0) {
|
||||
|
|
@ -193,7 +193,7 @@ normalize() {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVector2) FLOATNAME(LVector2)::
|
||||
INLINE_LINMATH FLOATNAME(LVector2) FLOATNAME(LVector2)::
|
||||
operator * (FLOATTYPE scalar) const {
|
||||
return FLOATNAME(LVector2)(FLOATNAME(LVecBase2)::operator * (scalar));
|
||||
}
|
||||
|
|
@ -203,7 +203,8 @@ operator * (FLOATTYPE scalar) const {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVector2) FLOATNAME(LVector2)::
|
||||
INLINE_LINMATH FLOATNAME(LVector2) FLOATNAME(LVector2)::
|
||||
operator / (FLOATTYPE scalar) const {
|
||||
return FLOATNAME(LVector2)(FLOATNAME(LVecBase2)::operator / (scalar));
|
||||
FLOATTYPE recip_scalar = 1.0/scalar;
|
||||
return FLOATNAME(LVector2)(FLOATNAME(LVecBase2)::operator * (recip_scalar));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,30 +9,30 @@
|
|||
////////////////////////////////////////////////////////////////////
|
||||
class EXPCL_PANDA FLOATNAME(LVector2) : public FLOATNAME(LVecBase2) {
|
||||
PUBLISHED:
|
||||
INLINE FLOATNAME(LVector2)();
|
||||
INLINE FLOATNAME(LVector2)(const FLOATNAME(LVecBase2) ©);
|
||||
INLINE FLOATNAME(LVector2) &operator = (const FLOATNAME(LVecBase2) ©);
|
||||
INLINE FLOATNAME(LVector2) &operator = (FLOATTYPE fill_value);
|
||||
INLINE FLOATNAME(LVector2)(FLOATTYPE fill_value);
|
||||
INLINE FLOATNAME(LVector2)(FLOATTYPE x, FLOATTYPE y);
|
||||
INLINE_LINMATH FLOATNAME(LVector2)();
|
||||
INLINE_LINMATH FLOATNAME(LVector2)(const FLOATNAME(LVecBase2) ©);
|
||||
INLINE_LINMATH FLOATNAME(LVector2) &operator = (const FLOATNAME(LVecBase2) ©);
|
||||
INLINE_LINMATH FLOATNAME(LVector2) &operator = (FLOATTYPE fill_value);
|
||||
INLINE_LINMATH FLOATNAME(LVector2)(FLOATTYPE fill_value);
|
||||
INLINE_LINMATH FLOATNAME(LVector2)(FLOATTYPE x, FLOATTYPE y);
|
||||
|
||||
INLINE static const FLOATNAME(LVector2) &zero();
|
||||
INLINE static const FLOATNAME(LVector2) &unit_x();
|
||||
INLINE static const FLOATNAME(LVector2) &unit_y();
|
||||
INLINE_LINMATH static const FLOATNAME(LVector2) &zero();
|
||||
INLINE_LINMATH static const FLOATNAME(LVector2) &unit_x();
|
||||
INLINE_LINMATH static const FLOATNAME(LVector2) &unit_y();
|
||||
|
||||
INLINE FLOATNAME(LVector2) operator - () const;
|
||||
INLINE_LINMATH FLOATNAME(LVector2) operator - () const;
|
||||
|
||||
INLINE FLOATNAME(LVecBase2) operator + (const FLOATNAME(LVecBase2) &other) const;
|
||||
INLINE FLOATNAME(LVector2) operator + (const FLOATNAME(LVector2) &other) const;
|
||||
INLINE_LINMATH FLOATNAME(LVecBase2) operator + (const FLOATNAME(LVecBase2) &other) const;
|
||||
INLINE_LINMATH FLOATNAME(LVector2) operator + (const FLOATNAME(LVector2) &other) const;
|
||||
|
||||
INLINE FLOATNAME(LVecBase2) operator - (const FLOATNAME(LVecBase2) &other) const;
|
||||
INLINE FLOATNAME(LVector2) operator - (const FLOATNAME(LVector2) &other) const;
|
||||
INLINE_LINMATH FLOATNAME(LVecBase2) operator - (const FLOATNAME(LVecBase2) &other) const;
|
||||
INLINE_LINMATH FLOATNAME(LVector2) operator - (const FLOATNAME(LVector2) &other) const;
|
||||
|
||||
INLINE FLOATTYPE length() const;
|
||||
INLINE FLOATTYPE length_squared() const;
|
||||
INLINE bool normalize();
|
||||
INLINE FLOATNAME(LVector2) operator * (FLOATTYPE scalar) const;
|
||||
INLINE FLOATNAME(LVector2) operator / (FLOATTYPE scalar) const;
|
||||
INLINE_LINMATH FLOATTYPE length() const;
|
||||
INLINE_LINMATH FLOATTYPE length_squared() const;
|
||||
INLINE_LINMATH bool normalize();
|
||||
INLINE_LINMATH FLOATNAME(LVector2) operator * (FLOATTYPE scalar) const;
|
||||
INLINE_LINMATH FLOATNAME(LVector2) operator / (FLOATTYPE scalar) const;
|
||||
|
||||
public:
|
||||
static TypeHandle get_class_type() {
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVector3)::
|
||||
INLINE_LINMATH FLOATNAME(LVector3)::
|
||||
FLOATNAME(LVector3)() {
|
||||
}
|
||||
|
||||
|
|
@ -18,7 +18,7 @@ FLOATNAME(LVector3)() {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVector3)::
|
||||
INLINE_LINMATH FLOATNAME(LVector3)::
|
||||
FLOATNAME(LVector3)(const FLOATNAME(LVecBase3) ©) : FLOATNAME(LVecBase3)(copy) {
|
||||
}
|
||||
|
||||
|
|
@ -27,7 +27,7 @@ FLOATNAME(LVector3)(const FLOATNAME(LVecBase3) ©) : FLOATNAME(LVecBase3)(cop
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVector3) &FLOATNAME(LVector3)::
|
||||
INLINE_LINMATH FLOATNAME(LVector3) &FLOATNAME(LVector3)::
|
||||
operator = (const FLOATNAME(LVecBase3) ©) {
|
||||
FLOATNAME(LVecBase3)::operator = (copy);
|
||||
return *this;
|
||||
|
|
@ -38,7 +38,7 @@ operator = (const FLOATNAME(LVecBase3) ©) {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVector3) &FLOATNAME(LVector3)::
|
||||
INLINE_LINMATH FLOATNAME(LVector3) &FLOATNAME(LVector3)::
|
||||
operator = (FLOATTYPE fill_value) {
|
||||
FLOATNAME(LVecBase3)::operator = (fill_value);
|
||||
return *this;
|
||||
|
|
@ -49,7 +49,7 @@ operator = (FLOATTYPE fill_value) {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVector3)::
|
||||
INLINE_LINMATH FLOATNAME(LVector3)::
|
||||
FLOATNAME(LVector3)(FLOATTYPE fill_value) :
|
||||
FLOATNAME(LVecBase3)(fill_value)
|
||||
{
|
||||
|
|
@ -60,7 +60,7 @@ FLOATNAME(LVector3)(FLOATTYPE fill_value) :
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVector3)::
|
||||
INLINE_LINMATH FLOATNAME(LVector3)::
|
||||
FLOATNAME(LVector3)(FLOATTYPE x, FLOATTYPE y, FLOATTYPE z) :
|
||||
FLOATNAME(LVecBase3)(x, y, z)
|
||||
{
|
||||
|
|
@ -71,7 +71,7 @@ FLOATNAME(LVector3)(FLOATTYPE x, FLOATTYPE y, FLOATTYPE z) :
|
|||
// Access: Public
|
||||
// Description: Returns a zero-length vector.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE const FLOATNAME(LVector3) &FLOATNAME(LVector3)::
|
||||
INLINE_LINMATH const FLOATNAME(LVector3) &FLOATNAME(LVector3)::
|
||||
zero() {
|
||||
return (const FLOATNAME(LVector3) &)FLOATNAME(LVecBase3)::zero();
|
||||
}
|
||||
|
|
@ -81,7 +81,7 @@ zero() {
|
|||
// Access: Public
|
||||
// Description: Returns a unit X vector.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE const FLOATNAME(LVector3) &FLOATNAME(LVector3)::
|
||||
INLINE_LINMATH const FLOATNAME(LVector3) &FLOATNAME(LVector3)::
|
||||
unit_x() {
|
||||
return (const FLOATNAME(LVector3) &)FLOATNAME(LVecBase3)::unit_x();
|
||||
}
|
||||
|
|
@ -91,7 +91,7 @@ unit_x() {
|
|||
// Access: Public
|
||||
// Description: Returns a unit Y vector.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE const FLOATNAME(LVector3) &FLOATNAME(LVector3)::
|
||||
INLINE_LINMATH const FLOATNAME(LVector3) &FLOATNAME(LVector3)::
|
||||
unit_y() {
|
||||
return (const FLOATNAME(LVector3) &)FLOATNAME(LVecBase3)::unit_y();
|
||||
}
|
||||
|
|
@ -101,7 +101,7 @@ unit_y() {
|
|||
// Access: Public
|
||||
// Description: Returns a unit Z vector.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE const FLOATNAME(LVector3) &FLOATNAME(LVector3)::
|
||||
INLINE_LINMATH const FLOATNAME(LVector3) &FLOATNAME(LVector3)::
|
||||
unit_z() {
|
||||
return (const FLOATNAME(LVector3) &)FLOATNAME(LVecBase3)::unit_z();
|
||||
}
|
||||
|
|
@ -111,7 +111,7 @@ unit_z() {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVector3) FLOATNAME(LVector3)::
|
||||
INLINE_LINMATH FLOATNAME(LVector3) FLOATNAME(LVector3)::
|
||||
operator - () const {
|
||||
return FLOATNAME(LVecBase3)::operator - ();
|
||||
}
|
||||
|
|
@ -121,7 +121,7 @@ operator - () const {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVecBase3) FLOATNAME(LVector3)::
|
||||
INLINE_LINMATH FLOATNAME(LVecBase3) FLOATNAME(LVector3)::
|
||||
operator + (const FLOATNAME(LVecBase3) &other) const {
|
||||
return FLOATNAME(LVecBase3)::operator + (other);
|
||||
}
|
||||
|
|
@ -131,7 +131,7 @@ operator + (const FLOATNAME(LVecBase3) &other) const {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVector3) FLOATNAME(LVector3)::
|
||||
INLINE_LINMATH FLOATNAME(LVector3) FLOATNAME(LVector3)::
|
||||
operator + (const FLOATNAME(LVector3) &other) const {
|
||||
return FLOATNAME(LVecBase3)::operator + (other);
|
||||
}
|
||||
|
|
@ -141,7 +141,7 @@ operator + (const FLOATNAME(LVector3) &other) const {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVecBase3) FLOATNAME(LVector3)::
|
||||
INLINE_LINMATH FLOATNAME(LVecBase3) FLOATNAME(LVector3)::
|
||||
operator - (const FLOATNAME(LVecBase3) &other) const {
|
||||
return FLOATNAME(LVecBase3)::operator - (other);
|
||||
}
|
||||
|
|
@ -151,7 +151,7 @@ operator - (const FLOATNAME(LVecBase3) &other) const {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVector3) FLOATNAME(LVector3)::
|
||||
INLINE_LINMATH FLOATNAME(LVector3) FLOATNAME(LVector3)::
|
||||
operator - (const FLOATNAME(LVector3) &other) const {
|
||||
return FLOATNAME(LVecBase3)::operator - (other);
|
||||
}
|
||||
|
|
@ -162,7 +162,7 @@ operator - (const FLOATNAME(LVector3) &other) const {
|
|||
// Description: Returns the length of the vector, by the Pythagorean
|
||||
// theorem.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATTYPE FLOATNAME(LVector3)::
|
||||
INLINE_LINMATH FLOATTYPE FLOATNAME(LVector3)::
|
||||
length() const {
|
||||
return csqrt((*this).dot(*this));
|
||||
}
|
||||
|
|
@ -173,7 +173,7 @@ length() const {
|
|||
// Description: Returns the square of the vector's length, cheap and
|
||||
// easy.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATTYPE FLOATNAME(LVector3)::
|
||||
INLINE_LINMATH FLOATTYPE FLOATNAME(LVector3)::
|
||||
length_squared() const {
|
||||
return (*this).dot(*this);
|
||||
}
|
||||
|
|
@ -185,7 +185,7 @@ length_squared() const {
|
|||
// vector was normalized, false if it was a zero-length
|
||||
// vector.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE bool FLOATNAME(LVector3)::
|
||||
INLINE_LINMATH bool FLOATNAME(LVector3)::
|
||||
normalize() {
|
||||
FLOATTYPE l2 = length_squared();
|
||||
if (l2 == (FLOATTYPE)0.0) {
|
||||
|
|
@ -204,7 +204,7 @@ normalize() {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVector3) FLOATNAME(LVector3)::
|
||||
INLINE_LINMATH FLOATNAME(LVector3) FLOATNAME(LVector3)::
|
||||
cross(const FLOATNAME(LVecBase3) &other) const {
|
||||
return FLOATNAME(LVecBase3)::cross(other);
|
||||
}
|
||||
|
|
@ -214,7 +214,7 @@ cross(const FLOATNAME(LVecBase3) &other) const {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVector3) FLOATNAME(LVector3)::
|
||||
INLINE_LINMATH FLOATNAME(LVector3) FLOATNAME(LVector3)::
|
||||
operator * (FLOATTYPE scalar) const {
|
||||
return FLOATNAME(LVector3)(FLOATNAME(LVecBase3)::operator * (scalar));
|
||||
}
|
||||
|
|
@ -224,9 +224,10 @@ operator * (FLOATTYPE scalar) const {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVector3) FLOATNAME(LVector3)::
|
||||
INLINE_LINMATH FLOATNAME(LVector3) FLOATNAME(LVector3)::
|
||||
operator / (FLOATTYPE scalar) const {
|
||||
return FLOATNAME(LVector3)(FLOATNAME(LVecBase3)::operator / (scalar));
|
||||
FLOATTYPE recip_scalar = 1.0/scalar;
|
||||
return FLOATNAME(LVector3)(FLOATNAME(LVecBase3)::operator * (recip_scalar));
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -235,7 +236,7 @@ operator / (FLOATTYPE scalar) const {
|
|||
// Description: Returns the up vector for the given coordinate
|
||||
// system.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVector3) FLOATNAME(LVector3)::
|
||||
INLINE_LINMATH FLOATNAME(LVector3) FLOATNAME(LVector3)::
|
||||
up(CoordinateSystem cs) {
|
||||
if (cs == CS_default) {
|
||||
cs = default_coordinate_system;
|
||||
|
|
@ -262,7 +263,7 @@ up(CoordinateSystem cs) {
|
|||
// Description: Returns the right vector for the given coordinate
|
||||
// system.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVector3) FLOATNAME(LVector3)::
|
||||
INLINE_LINMATH FLOATNAME(LVector3) FLOATNAME(LVector3)::
|
||||
right(CoordinateSystem) {
|
||||
return FLOATNAME(LVector3)(1.0, 0.0, 0.0);
|
||||
}
|
||||
|
|
@ -273,7 +274,7 @@ right(CoordinateSystem) {
|
|||
// Description: Returns the forward vector for the given coordinate
|
||||
// system.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVector3) FLOATNAME(LVector3)::
|
||||
INLINE_LINMATH FLOATNAME(LVector3) FLOATNAME(LVector3)::
|
||||
forward(CoordinateSystem cs) {
|
||||
if (cs == CS_default) {
|
||||
cs = default_coordinate_system;
|
||||
|
|
@ -304,7 +305,7 @@ forward(CoordinateSystem cs) {
|
|||
// Description: Returns the down vector for the given coordinate
|
||||
// system.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVector3) FLOATNAME(LVector3)::
|
||||
INLINE_LINMATH FLOATNAME(LVector3) FLOATNAME(LVector3)::
|
||||
down(CoordinateSystem cs) {
|
||||
return -up(cs);
|
||||
}
|
||||
|
|
@ -315,7 +316,7 @@ down(CoordinateSystem cs) {
|
|||
// Description: Returns the left vector for the given coordinate
|
||||
// system.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVector3) FLOATNAME(LVector3)::
|
||||
INLINE_LINMATH FLOATNAME(LVector3) FLOATNAME(LVector3)::
|
||||
left(CoordinateSystem cs) {
|
||||
return -right(cs);
|
||||
}
|
||||
|
|
@ -326,7 +327,7 @@ left(CoordinateSystem cs) {
|
|||
// Description: Returns the back vector for the given coordinate
|
||||
// system.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVector3) FLOATNAME(LVector3)::
|
||||
INLINE_LINMATH FLOATNAME(LVector3) FLOATNAME(LVector3)::
|
||||
back(CoordinateSystem cs) {
|
||||
return -forward(cs);
|
||||
}
|
||||
|
|
@ -338,8 +339,42 @@ back(CoordinateSystem cs) {
|
|||
// forward, and up components, in whatever way the
|
||||
// coordinate system represents that vector.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVector3) FLOATNAME(LVector3)::
|
||||
|
||||
//INLINE_LINMATH FLOATNAME(LVector3) & FLOATNAME(LVector3)::
|
||||
INLINE_LINMATH FLOATNAME(LVector3) FLOATNAME(LVector3)::
|
||||
rfu(FLOATTYPE right_v, FLOATTYPE fwd_v, FLOATTYPE up_v,
|
||||
CoordinateSystem cs) {
|
||||
return forward(cs) * fwd_v + up(cs) * up_v + right(cs) * right_v;
|
||||
|
||||
/* return forward(cs) * fwd_v + up(cs) * up_v + right(cs) * right_v; */
|
||||
|
||||
// fast implementation of above for axis-aligned coordinate systems
|
||||
|
||||
|
||||
if (cs == CS_default) {
|
||||
cs = default_coordinate_system;
|
||||
}
|
||||
FLOATTYPE vy,vz;
|
||||
switch(cs) {
|
||||
case CS_yup_right:
|
||||
vz = -fwd_v;
|
||||
vy = up_v;
|
||||
break;
|
||||
|
||||
case CS_yup_left:
|
||||
vz = fwd_v;
|
||||
vy = up_v;
|
||||
break;
|
||||
|
||||
case CS_zup_right:
|
||||
vy = fwd_v;
|
||||
vz = up_v;
|
||||
break;
|
||||
|
||||
case CS_zup_left:
|
||||
vy = -fwd_v;
|
||||
vz = up_v;
|
||||
}
|
||||
|
||||
return FLOATNAME(LVector3)(right_v,vy,vz);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,47 +15,46 @@
|
|||
////////////////////////////////////////////////////////////////////
|
||||
class EXPCL_PANDA FLOATNAME(LVector3) : public FLOATNAME(LVecBase3) {
|
||||
PUBLISHED:
|
||||
INLINE FLOATNAME(LVector3)();
|
||||
INLINE FLOATNAME(LVector3)(const FLOATNAME(LVecBase3) ©);
|
||||
INLINE FLOATNAME(LVector3) &operator = (const FLOATNAME(LVecBase3) ©);
|
||||
INLINE FLOATNAME(LVector3) &operator = (FLOATTYPE fill_value);
|
||||
INLINE FLOATNAME(LVector3)(FLOATTYPE fill_value);
|
||||
INLINE FLOATNAME(LVector3)(FLOATTYPE x, FLOATTYPE y, FLOATTYPE z);
|
||||
INLINE_LINMATH FLOATNAME(LVector3)();
|
||||
INLINE_LINMATH FLOATNAME(LVector3)(const FLOATNAME(LVecBase3) ©);
|
||||
INLINE_LINMATH FLOATNAME(LVector3) &operator = (const FLOATNAME(LVecBase3) ©);
|
||||
INLINE_LINMATH FLOATNAME(LVector3) &operator = (FLOATTYPE fill_value);
|
||||
INLINE_LINMATH FLOATNAME(LVector3)(FLOATTYPE fill_value);
|
||||
INLINE_LINMATH FLOATNAME(LVector3)(FLOATTYPE x, FLOATTYPE y, FLOATTYPE z);
|
||||
|
||||
INLINE static const FLOATNAME(LVector3) &zero();
|
||||
INLINE static const FLOATNAME(LVector3) &unit_x();
|
||||
INLINE static const FLOATNAME(LVector3) &unit_y();
|
||||
INLINE static const FLOATNAME(LVector3) &unit_z();
|
||||
INLINE_LINMATH static const FLOATNAME(LVector3) &zero();
|
||||
INLINE_LINMATH static const FLOATNAME(LVector3) &unit_x();
|
||||
INLINE_LINMATH static const FLOATNAME(LVector3) &unit_y();
|
||||
INLINE_LINMATH static const FLOATNAME(LVector3) &unit_z();
|
||||
|
||||
INLINE FLOATNAME(LVector3) operator - () const;
|
||||
INLINE_LINMATH FLOATNAME(LVector3) operator - () const;
|
||||
|
||||
INLINE FLOATNAME(LVecBase3) operator + (const FLOATNAME(LVecBase3) &other) const;
|
||||
INLINE FLOATNAME(LVector3) operator + (const FLOATNAME(LVector3) &other) const;
|
||||
INLINE_LINMATH FLOATNAME(LVecBase3) operator + (const FLOATNAME(LVecBase3) &other) const;
|
||||
INLINE_LINMATH FLOATNAME(LVector3) operator + (const FLOATNAME(LVector3) &other) const;
|
||||
|
||||
INLINE FLOATNAME(LVecBase3) operator - (const FLOATNAME(LVecBase3) &other) const;
|
||||
INLINE FLOATNAME(LVector3) operator - (const FLOATNAME(LVector3) &other) const;
|
||||
INLINE_LINMATH FLOATNAME(LVecBase3) operator - (const FLOATNAME(LVecBase3) &other) const;
|
||||
INLINE_LINMATH FLOATNAME(LVector3) operator - (const FLOATNAME(LVector3) &other) const;
|
||||
|
||||
INLINE FLOATTYPE length() const;
|
||||
INLINE FLOATTYPE length_squared() const;
|
||||
INLINE bool normalize();
|
||||
INLINE FLOATNAME(LVector3) cross(const FLOATNAME(LVecBase3) &other) const;
|
||||
INLINE FLOATNAME(LVector3) operator * (FLOATTYPE scalar) const;
|
||||
INLINE FLOATNAME(LVector3) operator / (FLOATTYPE scalar) const;
|
||||
INLINE_LINMATH FLOATTYPE length() const;
|
||||
INLINE_LINMATH FLOATTYPE length_squared() const;
|
||||
INLINE_LINMATH bool normalize();
|
||||
INLINE_LINMATH FLOATNAME(LVector3) cross(const FLOATNAME(LVecBase3) &other) const;
|
||||
INLINE_LINMATH FLOATNAME(LVector3) operator * (FLOATTYPE scalar) const;
|
||||
INLINE_LINMATH FLOATNAME(LVector3) operator / (FLOATTYPE scalar) const;
|
||||
|
||||
// Some special named constructors for LVector3.
|
||||
|
||||
INLINE static FLOATNAME(LVector3) up(CoordinateSystem cs = CS_default);
|
||||
INLINE static FLOATNAME(LVector3) right(CoordinateSystem cs = CS_default);
|
||||
INLINE static FLOATNAME(LVector3) forward(CoordinateSystem cs = CS_default);
|
||||
INLINE_LINMATH static FLOATNAME(LVector3) up(CoordinateSystem cs = CS_default);
|
||||
INLINE_LINMATH static FLOATNAME(LVector3) right(CoordinateSystem cs = CS_default);
|
||||
INLINE_LINMATH static FLOATNAME(LVector3) forward(CoordinateSystem cs = CS_default);
|
||||
|
||||
INLINE static FLOATNAME(LVector3) down(CoordinateSystem cs = CS_default);
|
||||
INLINE static FLOATNAME(LVector3) left(CoordinateSystem cs = CS_default);
|
||||
INLINE static FLOATNAME(LVector3) back(CoordinateSystem cs = CS_default);
|
||||
INLINE_LINMATH static FLOATNAME(LVector3) down(CoordinateSystem cs = CS_default);
|
||||
INLINE_LINMATH static FLOATNAME(LVector3) left(CoordinateSystem cs = CS_default);
|
||||
INLINE_LINMATH static FLOATNAME(LVector3) back(CoordinateSystem cs = CS_default);
|
||||
|
||||
INLINE static FLOATNAME(LVector3) rfu(FLOATTYPE right,
|
||||
FLOATTYPE fwd,
|
||||
FLOATTYPE up,
|
||||
CoordinateSystem cs = CS_default);
|
||||
// INLINE_LINMATH static FLOATNAME(LVector3) & rfu(FLOATTYPE right,
|
||||
INLINE_LINMATH static FLOATNAME(LVector3) rfu(FLOATTYPE right,
|
||||
FLOATTYPE fwd,FLOATTYPE up, CoordinateSystem cs = CS_default);
|
||||
|
||||
public:
|
||||
static TypeHandle get_class_type() {
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVector4)::
|
||||
INLINE_LINMATH FLOATNAME(LVector4)::
|
||||
FLOATNAME(LVector4)() {
|
||||
}
|
||||
|
||||
|
|
@ -18,7 +18,7 @@ FLOATNAME(LVector4)() {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVector4)::
|
||||
INLINE_LINMATH FLOATNAME(LVector4)::
|
||||
FLOATNAME(LVector4)(const FLOATNAME(LVecBase4) ©) : FLOATNAME(LVecBase4)(copy) {
|
||||
}
|
||||
|
||||
|
|
@ -27,7 +27,7 @@ FLOATNAME(LVector4)(const FLOATNAME(LVecBase4) ©) : FLOATNAME(LVecBase4)(cop
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVector4) &FLOATNAME(LVector4)::
|
||||
INLINE_LINMATH FLOATNAME(LVector4) &FLOATNAME(LVector4)::
|
||||
operator = (const FLOATNAME(LVecBase4) ©) {
|
||||
FLOATNAME(LVecBase4)::operator = (copy);
|
||||
return *this;
|
||||
|
|
@ -38,7 +38,7 @@ operator = (const FLOATNAME(LVecBase4) ©) {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVector4) &FLOATNAME(LVector4)::
|
||||
INLINE_LINMATH FLOATNAME(LVector4) &FLOATNAME(LVector4)::
|
||||
operator = (FLOATTYPE fill_value) {
|
||||
FLOATNAME(LVecBase4)::operator = (fill_value);
|
||||
return *this;
|
||||
|
|
@ -49,7 +49,7 @@ operator = (FLOATTYPE fill_value) {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVector4)::
|
||||
INLINE_LINMATH FLOATNAME(LVector4)::
|
||||
FLOATNAME(LVector4)(FLOATTYPE fill_value) :
|
||||
FLOATNAME(LVecBase4)(fill_value)
|
||||
{
|
||||
|
|
@ -60,7 +60,7 @@ FLOATNAME(LVector4)(FLOATTYPE fill_value) :
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVector4)::
|
||||
INLINE_LINMATH FLOATNAME(LVector4)::
|
||||
FLOATNAME(LVector4)(FLOATTYPE x, FLOATTYPE y, FLOATTYPE z, FLOATTYPE w) :
|
||||
FLOATNAME(LVecBase4)(x, y, z, w)
|
||||
{
|
||||
|
|
@ -71,7 +71,7 @@ FLOATNAME(LVector4)(FLOATTYPE x, FLOATTYPE y, FLOATTYPE z, FLOATTYPE w) :
|
|||
// Access: Public
|
||||
// Description: Returns a zero-length vector.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE const FLOATNAME(LVector4) &FLOATNAME(LVector4)::
|
||||
INLINE_LINMATH const FLOATNAME(LVector4) &FLOATNAME(LVector4)::
|
||||
zero() {
|
||||
return (const FLOATNAME(LVector4) &)FLOATNAME(LVecBase4)::zero();
|
||||
}
|
||||
|
|
@ -81,7 +81,7 @@ zero() {
|
|||
// Access: Public
|
||||
// Description: Returns a unit X vector.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE const FLOATNAME(LVector4) &FLOATNAME(LVector4)::
|
||||
INLINE_LINMATH const FLOATNAME(LVector4) &FLOATNAME(LVector4)::
|
||||
unit_x() {
|
||||
return (const FLOATNAME(LVector4) &)FLOATNAME(LVecBase4)::unit_x();
|
||||
}
|
||||
|
|
@ -91,7 +91,7 @@ unit_x() {
|
|||
// Access: Public
|
||||
// Description: Returns a unit Y vector.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE const FLOATNAME(LVector4) &FLOATNAME(LVector4)::
|
||||
INLINE_LINMATH const FLOATNAME(LVector4) &FLOATNAME(LVector4)::
|
||||
unit_y() {
|
||||
return (const FLOATNAME(LVector4) &)FLOATNAME(LVecBase4)::unit_y();
|
||||
}
|
||||
|
|
@ -101,7 +101,7 @@ unit_y() {
|
|||
// Access: Public
|
||||
// Description: Returns a unit Z vector.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE const FLOATNAME(LVector4) &FLOATNAME(LVector4)::
|
||||
INLINE_LINMATH const FLOATNAME(LVector4) &FLOATNAME(LVector4)::
|
||||
unit_z() {
|
||||
return (const FLOATNAME(LVector4) &)FLOATNAME(LVecBase4)::unit_z();
|
||||
}
|
||||
|
|
@ -111,7 +111,7 @@ unit_z() {
|
|||
// Access: Public
|
||||
// Description: Returns a unit W vector.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE const FLOATNAME(LVector4) &FLOATNAME(LVector4)::
|
||||
INLINE_LINMATH const FLOATNAME(LVector4) &FLOATNAME(LVector4)::
|
||||
unit_w() {
|
||||
return (const FLOATNAME(LVector4) &)FLOATNAME(LVecBase4)::unit_w();
|
||||
}
|
||||
|
|
@ -121,7 +121,7 @@ unit_w() {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVector4) FLOATNAME(LVector4)::
|
||||
INLINE_LINMATH FLOATNAME(LVector4) FLOATNAME(LVector4)::
|
||||
operator - () const {
|
||||
return FLOATNAME(LVecBase4)::operator - ();
|
||||
}
|
||||
|
|
@ -131,7 +131,7 @@ operator - () const {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVecBase4) FLOATNAME(LVector4)::
|
||||
INLINE_LINMATH FLOATNAME(LVecBase4) FLOATNAME(LVector4)::
|
||||
operator + (const FLOATNAME(LVecBase4) &other) const {
|
||||
return FLOATNAME(LVecBase4)::operator + (other);
|
||||
}
|
||||
|
|
@ -141,7 +141,7 @@ operator + (const FLOATNAME(LVecBase4) &other) const {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVector4) FLOATNAME(LVector4)::
|
||||
INLINE_LINMATH FLOATNAME(LVector4) FLOATNAME(LVector4)::
|
||||
operator + (const FLOATNAME(LVector4) &other) const {
|
||||
return FLOATNAME(LVecBase4)::operator + (other);
|
||||
}
|
||||
|
|
@ -151,7 +151,7 @@ operator + (const FLOATNAME(LVector4) &other) const {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVecBase4) FLOATNAME(LVector4)::
|
||||
INLINE_LINMATH FLOATNAME(LVecBase4) FLOATNAME(LVector4)::
|
||||
operator - (const FLOATNAME(LVecBase4) &other) const {
|
||||
return FLOATNAME(LVecBase4)::operator - (other);
|
||||
}
|
||||
|
|
@ -161,7 +161,7 @@ operator - (const FLOATNAME(LVecBase4) &other) const {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVector4) FLOATNAME(LVector4)::
|
||||
INLINE_LINMATH FLOATNAME(LVector4) FLOATNAME(LVector4)::
|
||||
operator - (const FLOATNAME(LVector4) &other) const {
|
||||
return FLOATNAME(LVecBase4)::operator - (other);
|
||||
}
|
||||
|
|
@ -172,7 +172,7 @@ operator - (const FLOATNAME(LVector4) &other) const {
|
|||
// Description: Returns the length of the vector, by the Pythagorean
|
||||
// theorem.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATTYPE FLOATNAME(LVector4)::
|
||||
INLINE_LINMATH FLOATTYPE FLOATNAME(LVector4)::
|
||||
length() const {
|
||||
return csqrt((*this).dot(*this));
|
||||
}
|
||||
|
|
@ -183,7 +183,7 @@ length() const {
|
|||
// Description: Returns the square of the vector's length, cheap and
|
||||
// easy.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATTYPE FLOATNAME(LVector4)::
|
||||
INLINE_LINMATH FLOATTYPE FLOATNAME(LVector4)::
|
||||
length_squared() const {
|
||||
return (*this).dot(*this);
|
||||
}
|
||||
|
|
@ -195,7 +195,7 @@ length_squared() const {
|
|||
// vector was normalized, false if it was a zero-length
|
||||
// vector.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE bool FLOATNAME(LVector4)::
|
||||
INLINE_LINMATH bool FLOATNAME(LVector4)::
|
||||
normalize() {
|
||||
FLOATTYPE l2 = length_squared();
|
||||
if (l2 == (FLOATTYPE)0.0) {
|
||||
|
|
@ -214,7 +214,7 @@ normalize() {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVector4) FLOATNAME(LVector4)::
|
||||
INLINE_LINMATH FLOATNAME(LVector4) FLOATNAME(LVector4)::
|
||||
operator * (FLOATTYPE scalar) const {
|
||||
return FLOATNAME(LVector4)(FLOATNAME(LVecBase4)::operator * (scalar));
|
||||
}
|
||||
|
|
@ -224,7 +224,8 @@ operator * (FLOATTYPE scalar) const {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVector4) FLOATNAME(LVector4)::
|
||||
INLINE_LINMATH FLOATNAME(LVector4) FLOATNAME(LVector4)::
|
||||
operator / (FLOATTYPE scalar) const {
|
||||
return FLOATNAME(LVector4)(FLOATNAME(LVecBase4)::operator / (scalar));
|
||||
FLOATTYPE recip_scalar = 1.0/scalar;
|
||||
return FLOATNAME(LVector4)(FLOATNAME(LVecBase4)::operator * (recip_scalar));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,32 +9,32 @@
|
|||
////////////////////////////////////////////////////////////////////
|
||||
class EXPCL_PANDA FLOATNAME(LVector4) : public FLOATNAME(LVecBase4) {
|
||||
PUBLISHED:
|
||||
INLINE FLOATNAME(LVector4)();
|
||||
INLINE FLOATNAME(LVector4)(const FLOATNAME(LVecBase4) ©);
|
||||
INLINE FLOATNAME(LVector4) &operator = (const FLOATNAME(LVecBase4) ©);
|
||||
INLINE FLOATNAME(LVector4) &operator = (FLOATTYPE fill_value);
|
||||
INLINE FLOATNAME(LVector4)(FLOATTYPE fill_value);
|
||||
INLINE FLOATNAME(LVector4)(FLOATTYPE x, FLOATTYPE y, FLOATTYPE z, FLOATTYPE w);
|
||||
INLINE_LINMATH FLOATNAME(LVector4)();
|
||||
INLINE_LINMATH FLOATNAME(LVector4)(const FLOATNAME(LVecBase4) ©);
|
||||
INLINE_LINMATH FLOATNAME(LVector4) &operator = (const FLOATNAME(LVecBase4) ©);
|
||||
INLINE_LINMATH FLOATNAME(LVector4) &operator = (FLOATTYPE fill_value);
|
||||
INLINE_LINMATH FLOATNAME(LVector4)(FLOATTYPE fill_value);
|
||||
INLINE_LINMATH FLOATNAME(LVector4)(FLOATTYPE x, FLOATTYPE y, FLOATTYPE z, FLOATTYPE w);
|
||||
|
||||
INLINE static const FLOATNAME(LVector4) &zero();
|
||||
INLINE static const FLOATNAME(LVector4) &unit_x();
|
||||
INLINE static const FLOATNAME(LVector4) &unit_y();
|
||||
INLINE static const FLOATNAME(LVector4) &unit_z();
|
||||
INLINE static const FLOATNAME(LVector4) &unit_w();
|
||||
INLINE_LINMATH static const FLOATNAME(LVector4) &zero();
|
||||
INLINE_LINMATH static const FLOATNAME(LVector4) &unit_x();
|
||||
INLINE_LINMATH static const FLOATNAME(LVector4) &unit_y();
|
||||
INLINE_LINMATH static const FLOATNAME(LVector4) &unit_z();
|
||||
INLINE_LINMATH static const FLOATNAME(LVector4) &unit_w();
|
||||
|
||||
INLINE FLOATNAME(LVector4) operator - () const;
|
||||
INLINE_LINMATH FLOATNAME(LVector4) operator - () const;
|
||||
|
||||
INLINE FLOATNAME(LVecBase4) operator + (const FLOATNAME(LVecBase4) &other) const;
|
||||
INLINE FLOATNAME(LVector4) operator + (const FLOATNAME(LVector4) &other) const;
|
||||
INLINE_LINMATH FLOATNAME(LVecBase4) operator + (const FLOATNAME(LVecBase4) &other) const;
|
||||
INLINE_LINMATH FLOATNAME(LVector4) operator + (const FLOATNAME(LVector4) &other) const;
|
||||
|
||||
INLINE FLOATNAME(LVecBase4) operator - (const FLOATNAME(LVecBase4) &other) const;
|
||||
INLINE FLOATNAME(LVector4) operator - (const FLOATNAME(LVector4) &other) const;
|
||||
INLINE_LINMATH FLOATNAME(LVecBase4) operator - (const FLOATNAME(LVecBase4) &other) const;
|
||||
INLINE_LINMATH FLOATNAME(LVector4) operator - (const FLOATNAME(LVector4) &other) const;
|
||||
|
||||
INLINE FLOATTYPE length() const;
|
||||
INLINE FLOATTYPE length_squared() const;
|
||||
INLINE bool normalize();
|
||||
INLINE FLOATNAME(LVector4) operator * (FLOATTYPE scalar) const;
|
||||
INLINE FLOATNAME(LVector4) operator / (FLOATTYPE scalar) const;
|
||||
INLINE_LINMATH FLOATTYPE length() const;
|
||||
INLINE_LINMATH FLOATTYPE length_squared() const;
|
||||
INLINE_LINMATH bool normalize();
|
||||
INLINE_LINMATH FLOATNAME(LVector4) operator * (FLOATTYPE scalar) const;
|
||||
INLINE_LINMATH FLOATNAME(LVector4) operator / (FLOATTYPE scalar) const;
|
||||
|
||||
public:
|
||||
static TypeHandle get_class_type() {
|
||||
|
|
|
|||
|
|
@ -10,12 +10,12 @@
|
|||
// The following two functions are defined just to make the
|
||||
// NEARLY_ZERO() macro work. They each return a suitable nearly-zero
|
||||
// value for their corresponding numeric type.
|
||||
INLINE double
|
||||
INLINE_LINMATH double
|
||||
get_nearly_zero_value(double) {
|
||||
return 1.0e-12;
|
||||
}
|
||||
|
||||
INLINE float
|
||||
INLINE_LINMATH float
|
||||
get_nearly_zero_value(float) {
|
||||
return 1.0e-6f;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,27 +3,27 @@
|
|||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
INLINE BoundingHexahedron::
|
||||
INLINE_MATHUTIL BoundingHexahedron::
|
||||
BoundingHexahedron() {
|
||||
}
|
||||
|
||||
INLINE int BoundingHexahedron::
|
||||
INLINE_MATHUTIL int BoundingHexahedron::
|
||||
get_num_points() const {
|
||||
return num_points;
|
||||
}
|
||||
|
||||
INLINE LPoint3f BoundingHexahedron::
|
||||
INLINE_MATHUTIL LPoint3f BoundingHexahedron::
|
||||
get_point(int n) const {
|
||||
nassertr(n >= 0 && n < num_points, LPoint3f(0.0, 0.0, 0.0));
|
||||
return _points[n];
|
||||
}
|
||||
|
||||
INLINE int BoundingHexahedron::
|
||||
INLINE_MATHUTIL int BoundingHexahedron::
|
||||
get_num_planes() const {
|
||||
return num_planes;
|
||||
}
|
||||
|
||||
INLINE Planef BoundingHexahedron::
|
||||
INLINE_MATHUTIL Planef BoundingHexahedron::
|
||||
get_plane(int n) const {
|
||||
nassertr(n >= 0 && n < num_planes, Planef());
|
||||
return _planes[n];
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
////////////////////////////////////////////////////////////////////
|
||||
class EXPCL_PANDA BoundingHexahedron : public FiniteBoundingVolume {
|
||||
public:
|
||||
INLINE BoundingHexahedron();
|
||||
INLINE_MATHUTIL BoundingHexahedron();
|
||||
BoundingHexahedron(const Frustumf &frustum, bool is_ortho,
|
||||
CoordinateSystem cs = CS_default);
|
||||
virtual BoundingVolume *make_copy() const;
|
||||
|
|
@ -41,10 +41,10 @@ public:
|
|||
virtual void output(ostream &out) const;
|
||||
virtual void write(ostream &out, int indent_level = 0) const;
|
||||
|
||||
INLINE int get_num_points() const;
|
||||
INLINE LPoint3f get_point(int n) const;
|
||||
INLINE int get_num_planes() const;
|
||||
INLINE Planef get_plane(int n) const;
|
||||
INLINE_MATHUTIL int get_num_points() const;
|
||||
INLINE_MATHUTIL LPoint3f get_point(int n) const;
|
||||
INLINE_MATHUTIL int get_num_planes() const;
|
||||
INLINE_MATHUTIL Planef get_plane(int n) const;
|
||||
|
||||
protected:
|
||||
virtual bool extend_other(BoundingVolume *other) const;
|
||||
|
|
|
|||
|
|
@ -3,11 +3,11 @@
|
|||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
INLINE BoundingLine::
|
||||
INLINE_MATHUTIL BoundingLine::
|
||||
BoundingLine() {
|
||||
}
|
||||
|
||||
INLINE BoundingLine::
|
||||
INLINE_MATHUTIL BoundingLine::
|
||||
BoundingLine(const LPoint3f &a, const LPoint3f &b) :
|
||||
_origin(a), _vector(b - a)
|
||||
{
|
||||
|
|
@ -18,14 +18,14 @@ BoundingLine(const LPoint3f &a, const LPoint3f &b) :
|
|||
}
|
||||
}
|
||||
|
||||
INLINE const LPoint3f &BoundingLine::
|
||||
INLINE_MATHUTIL const LPoint3f &BoundingLine::
|
||||
get_point_a() const {
|
||||
nassertr(!is_empty(), _origin);
|
||||
nassertr(!is_infinite(), _origin);
|
||||
return _origin;
|
||||
}
|
||||
|
||||
INLINE LPoint3f BoundingLine::
|
||||
INLINE_MATHUTIL LPoint3f BoundingLine::
|
||||
get_point_b() const {
|
||||
nassertr(!is_empty(), _origin);
|
||||
nassertr(!is_infinite(), _origin);
|
||||
|
|
|
|||
|
|
@ -23,8 +23,8 @@
|
|||
////////////////////////////////////////////////////////////////////
|
||||
class EXPCL_PANDA BoundingLine : public GeometricBoundingVolume {
|
||||
PUBLISHED:
|
||||
INLINE BoundingLine();
|
||||
INLINE BoundingLine(const LPoint3f &a, const LPoint3f &b);
|
||||
INLINE_MATHUTIL BoundingLine();
|
||||
INLINE_MATHUTIL BoundingLine(const LPoint3f &a, const LPoint3f &b);
|
||||
|
||||
public:
|
||||
virtual BoundingVolume *make_copy() const;
|
||||
|
|
@ -35,8 +35,8 @@ public:
|
|||
virtual void output(ostream &out) const;
|
||||
|
||||
PUBLISHED:
|
||||
INLINE const LPoint3f &get_point_a() const;
|
||||
INLINE LPoint3f get_point_b() const;
|
||||
INLINE_MATHUTIL const LPoint3f &get_point_a() const;
|
||||
INLINE_MATHUTIL LPoint3f get_point_b() const;
|
||||
|
||||
protected:
|
||||
virtual bool extend_other(BoundingVolume *other) const;
|
||||
|
|
|
|||
|
|
@ -3,11 +3,11 @@
|
|||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
INLINE BoundingSphere::
|
||||
INLINE_MATHUTIL BoundingSphere::
|
||||
BoundingSphere() {
|
||||
}
|
||||
|
||||
INLINE BoundingSphere::
|
||||
INLINE_MATHUTIL BoundingSphere::
|
||||
BoundingSphere(const LPoint3f ¢er, float radius) :
|
||||
_center(center), _radius(radius)
|
||||
{
|
||||
|
|
@ -17,14 +17,14 @@ BoundingSphere(const LPoint3f ¢er, float radius) :
|
|||
}
|
||||
}
|
||||
|
||||
INLINE const LPoint3f &BoundingSphere::
|
||||
INLINE_MATHUTIL const LPoint3f &BoundingSphere::
|
||||
get_center() const {
|
||||
nassertr(!is_empty(), _center);
|
||||
nassertr(!is_infinite(), _center);
|
||||
return _center;
|
||||
}
|
||||
|
||||
INLINE float BoundingSphere::
|
||||
INLINE_MATHUTIL float BoundingSphere::
|
||||
get_radius() const {
|
||||
nassertr(!is_empty(), 0.0);
|
||||
nassertr(!is_infinite(), 0.0);
|
||||
|
|
|
|||
|
|
@ -18,8 +18,8 @@
|
|||
////////////////////////////////////////////////////////////////////
|
||||
class EXPCL_PANDA BoundingSphere : public FiniteBoundingVolume {
|
||||
PUBLISHED:
|
||||
INLINE BoundingSphere();
|
||||
INLINE BoundingSphere(const LPoint3f ¢er, float radius);
|
||||
INLINE_MATHUTIL BoundingSphere();
|
||||
INLINE_MATHUTIL BoundingSphere(const LPoint3f ¢er, float radius);
|
||||
|
||||
public:
|
||||
virtual BoundingVolume *make_copy() const;
|
||||
|
|
@ -33,8 +33,8 @@ public:
|
|||
virtual void output(ostream &out) const;
|
||||
|
||||
PUBLISHED:
|
||||
INLINE const LPoint3f &get_center() const;
|
||||
INLINE float get_radius() const;
|
||||
INLINE_MATHUTIL const LPoint3f &get_center() const;
|
||||
INLINE_MATHUTIL float get_radius() const;
|
||||
|
||||
protected:
|
||||
virtual bool extend_other(BoundingVolume *other) const;
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE BoundingVolume::
|
||||
INLINE_MATHUTIL BoundingVolume::
|
||||
BoundingVolume() {
|
||||
_flags = F_empty;
|
||||
}
|
||||
|
|
@ -22,7 +22,7 @@ BoundingVolume() {
|
|||
// since that contains one point (the center). It
|
||||
// intersects with no other volumes.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE bool BoundingVolume::
|
||||
INLINE_MATHUTIL bool BoundingVolume::
|
||||
is_empty() const {
|
||||
return (_flags & F_empty) != 0;
|
||||
}
|
||||
|
|
@ -43,7 +43,7 @@ is_empty() const {
|
|||
// It completely intersects with all other volumes
|
||||
// except empty volumes.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE bool BoundingVolume::
|
||||
INLINE_MATHUTIL bool BoundingVolume::
|
||||
is_infinite() const {
|
||||
return (_flags & F_infinite) != 0;
|
||||
}
|
||||
|
|
@ -55,7 +55,7 @@ is_infinite() const {
|
|||
// finite. You can think of this as an infinite
|
||||
// extend_by() operation.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void BoundingVolume::
|
||||
INLINE_MATHUTIL void BoundingVolume::
|
||||
set_infinite() {
|
||||
_flags = F_infinite;
|
||||
}
|
||||
|
|
@ -66,7 +66,7 @@ set_infinite() {
|
|||
// Description: Increases the size of the volume to include the given
|
||||
// volume.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE bool BoundingVolume::
|
||||
INLINE_MATHUTIL bool BoundingVolume::
|
||||
extend_by(const BoundingVolume *vol) {
|
||||
if (vol->is_infinite()) {
|
||||
set_infinite();
|
||||
|
|
@ -88,7 +88,7 @@ extend_by(const BoundingVolume *vol) {
|
|||
// indicate the amount of intersection with the
|
||||
// indicated volume.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE int BoundingVolume::
|
||||
INLINE_MATHUTIL int BoundingVolume::
|
||||
contains(const BoundingVolume *vol) const {
|
||||
if (is_empty() || vol->is_empty()) {
|
||||
return IF_no_intersection;
|
||||
|
|
@ -106,7 +106,7 @@ contains(const BoundingVolume *vol) const {
|
|||
return vol->contains_other(this);
|
||||
}
|
||||
|
||||
INLINE ostream &operator << (ostream &out, const BoundingVolume &bound) {
|
||||
INLINE_MATHUTIL ostream &operator << (ostream &out, const BoundingVolume &bound) {
|
||||
bound.output(out);
|
||||
return out;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,15 +28,15 @@ class BoundingLine;
|
|||
////////////////////////////////////////////////////////////////////
|
||||
class EXPCL_PANDA BoundingVolume : public TypedReferenceCount {
|
||||
PUBLISHED:
|
||||
INLINE BoundingVolume();
|
||||
INLINE_MATHUTIL BoundingVolume();
|
||||
virtual BoundingVolume *make_copy() const=0;
|
||||
|
||||
INLINE bool is_empty() const;
|
||||
INLINE bool is_infinite() const;
|
||||
INLINE_MATHUTIL bool is_empty() const;
|
||||
INLINE_MATHUTIL bool is_infinite() const;
|
||||
|
||||
INLINE void set_infinite();
|
||||
INLINE_MATHUTIL void set_infinite();
|
||||
|
||||
INLINE bool extend_by(const BoundingVolume *vol);
|
||||
INLINE_MATHUTIL bool extend_by(const BoundingVolume *vol);
|
||||
|
||||
// It might be nice to make these template member functions so we
|
||||
// could have true STL-style first/last iterators, but that's
|
||||
|
|
@ -76,7 +76,7 @@ PUBLISHED:
|
|||
IF_dont_understand = 0x08
|
||||
};
|
||||
|
||||
INLINE int contains(const BoundingVolume *vol) const;
|
||||
INLINE_MATHUTIL int contains(const BoundingVolume *vol) const;
|
||||
|
||||
virtual void output(ostream &out) const=0;
|
||||
virtual void write(ostream &out, int indent_level = 0) const;
|
||||
|
|
@ -140,7 +140,7 @@ private:
|
|||
friend class BoundingLine;
|
||||
};
|
||||
|
||||
INLINE ostream &operator << (ostream &out, const BoundingVolume &bound);
|
||||
INLINE_MATHUTIL ostream &operator << (ostream &out, const BoundingVolume &bound);
|
||||
|
||||
#include "boundingVolume.I"
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
// Access:
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(Frustum)::
|
||||
INLINE_MATHUTIL FLOATNAME(Frustum)::
|
||||
FLOATNAME(Frustum)() {
|
||||
_fnear = 1.4142;
|
||||
_ffar = 10.0;
|
||||
|
|
@ -23,7 +23,7 @@ FLOATNAME(Frustum)() {
|
|||
// Access:
|
||||
// Description: Sets up a two-dimensional orthographic frustum
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void FLOATNAME(Frustum)::make_ortho_2D(void) {
|
||||
INLINE_MATHUTIL void FLOATNAME(Frustum)::make_ortho_2D(void) {
|
||||
make_ortho(-1, 1);
|
||||
}
|
||||
|
||||
|
|
@ -32,7 +32,7 @@ INLINE void FLOATNAME(Frustum)::make_ortho_2D(void) {
|
|||
// Access:
|
||||
// Description: Sets up a two-dimensional orthographic frustum
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void FLOATNAME(Frustum)::
|
||||
INLINE_MATHUTIL void FLOATNAME(Frustum)::
|
||||
make_ortho_2D(FLOATTYPE l, FLOATTYPE r, FLOATTYPE t, FLOATTYPE b) {
|
||||
make_ortho(-1, 1, l, r, t, b);
|
||||
}
|
||||
|
|
@ -42,7 +42,7 @@ make_ortho_2D(FLOATTYPE l, FLOATTYPE r, FLOATTYPE t, FLOATTYPE b) {
|
|||
// Access:
|
||||
// Description: Behaves like gluOrtho
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void FLOATNAME(Frustum)::make_ortho(FLOATTYPE fnear, FLOATTYPE ffar) {
|
||||
INLINE_MATHUTIL void FLOATNAME(Frustum)::make_ortho(FLOATTYPE fnear, FLOATTYPE ffar) {
|
||||
_fnear = fnear;
|
||||
_ffar = ffar;
|
||||
_l = -1;
|
||||
|
|
@ -56,7 +56,7 @@ INLINE void FLOATNAME(Frustum)::make_ortho(FLOATTYPE fnear, FLOATTYPE ffar) {
|
|||
// Access:
|
||||
// Description: Behaves like gluOrtho
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void FLOATNAME(Frustum)::
|
||||
INLINE_MATHUTIL void FLOATNAME(Frustum)::
|
||||
make_ortho(FLOATTYPE fnear, FLOATTYPE ffar, FLOATTYPE l, FLOATTYPE r,
|
||||
FLOATTYPE t, FLOATTYPE b) {
|
||||
_fnear = fnear;
|
||||
|
|
@ -89,7 +89,7 @@ make_ortho(FLOATTYPE fnear, FLOATTYPE ffar, FLOATTYPE l, FLOATTYPE r,
|
|||
// W yfov
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void FLOATNAME(Frustum)::
|
||||
INLINE_MATHUTIL void FLOATNAME(Frustum)::
|
||||
make_perspective_hfov(FLOATTYPE hfov, FLOATTYPE aspect, FLOATTYPE fnear,
|
||||
FLOATTYPE ffar) {
|
||||
_fnear = fnear;
|
||||
|
|
@ -101,7 +101,7 @@ make_perspective_hfov(FLOATTYPE hfov, FLOATTYPE aspect, FLOATTYPE fnear,
|
|||
}
|
||||
|
||||
|
||||
INLINE void FLOATNAME(Frustum)::
|
||||
INLINE_MATHUTIL void FLOATNAME(Frustum)::
|
||||
make_perspective_vfov(FLOATTYPE yfov, FLOATTYPE aspect, FLOATTYPE fnear,
|
||||
FLOATTYPE ffar) {
|
||||
_fnear = fnear;
|
||||
|
|
@ -113,7 +113,7 @@ make_perspective_vfov(FLOATTYPE yfov, FLOATTYPE aspect, FLOATTYPE fnear,
|
|||
}
|
||||
|
||||
|
||||
INLINE void FLOATNAME(Frustum)::
|
||||
INLINE_MATHUTIL void FLOATNAME(Frustum)::
|
||||
make_perspective(FLOATTYPE xfov, FLOATTYPE yfov, FLOATTYPE fnear,
|
||||
FLOATTYPE ffar) {
|
||||
_fnear = fnear;
|
||||
|
|
@ -129,7 +129,7 @@ make_perspective(FLOATTYPE xfov, FLOATTYPE yfov, FLOATTYPE fnear,
|
|||
// Access:
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void FLOATNAME(Frustum)::
|
||||
INLINE_MATHUTIL void FLOATNAME(Frustum)::
|
||||
get_perspective_params(FLOATTYPE& yfov, FLOATTYPE& aspect,
|
||||
FLOATTYPE& fnear, FLOATTYPE& ffar) const {
|
||||
yfov = rad_2_deg(atan(_t / _fnear)) * 2.0;
|
||||
|
|
@ -143,7 +143,7 @@ get_perspective_params(FLOATTYPE& yfov, FLOATTYPE& aspect,
|
|||
// Access:
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void FLOATNAME(Frustum)::
|
||||
INLINE_MATHUTIL void FLOATNAME(Frustum)::
|
||||
get_perspective_params(FLOATTYPE& xfov, FLOATTYPE& yfov, FLOATTYPE& aspect,
|
||||
FLOATTYPE& fnear, FLOATTYPE& ffar) const {
|
||||
xfov = rad_2_deg(atan(_r / _fnear)) * 2.0;
|
||||
|
|
@ -157,7 +157,7 @@ get_perspective_params(FLOATTYPE& xfov, FLOATTYPE& yfov, FLOATTYPE& aspect,
|
|||
// perspective transform defined by the frustum,
|
||||
// accordinate to the indicated coordinate system.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LMatrix4) FLOATNAME(Frustum)::
|
||||
INLINE_MATHUTIL FLOATNAME(LMatrix4) FLOATNAME(Frustum)::
|
||||
get_perspective_projection_mat(CoordinateSystem cs) const {
|
||||
if (cs == CS_default) {
|
||||
cs = default_coordinate_system;
|
||||
|
|
@ -205,7 +205,7 @@ get_perspective_projection_mat(CoordinateSystem cs) const {
|
|||
// orthographic transform defined by the frustum,
|
||||
// accordinate to the indicated coordinate system.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LMatrix4) FLOATNAME(Frustum)::
|
||||
INLINE_MATHUTIL FLOATNAME(LMatrix4) FLOATNAME(Frustum)::
|
||||
get_ortho_projection_mat(CoordinateSystem cs) const {
|
||||
if (cs == CS_default) {
|
||||
cs = default_coordinate_system;
|
||||
|
|
|
|||
|
|
@ -9,32 +9,32 @@
|
|||
////////////////////////////////////////////////////////////////////
|
||||
class EXPCL_PANDA FLOATNAME(Frustum) {
|
||||
PUBLISHED:
|
||||
INLINE FLOATNAME(Frustum)();
|
||||
INLINE_MATHUTIL FLOATNAME(Frustum)();
|
||||
|
||||
INLINE void make_ortho_2D(void);
|
||||
INLINE void make_ortho_2D(FLOATTYPE l, FLOATTYPE r, FLOATTYPE t, FLOATTYPE b);
|
||||
INLINE_MATHUTIL void make_ortho_2D(void);
|
||||
INLINE_MATHUTIL void make_ortho_2D(FLOATTYPE l, FLOATTYPE r, FLOATTYPE t, FLOATTYPE b);
|
||||
|
||||
INLINE void make_ortho(FLOATTYPE fnear, FLOATTYPE ffar);
|
||||
INLINE void make_ortho(FLOATTYPE fnear, FLOATTYPE ffar,
|
||||
INLINE_MATHUTIL void make_ortho(FLOATTYPE fnear, FLOATTYPE ffar);
|
||||
INLINE_MATHUTIL void make_ortho(FLOATTYPE fnear, FLOATTYPE ffar,
|
||||
FLOATTYPE l, FLOATTYPE r, FLOATTYPE t, FLOATTYPE b);
|
||||
|
||||
INLINE void make_perspective_hfov(FLOATTYPE xfov, FLOATTYPE aspect,
|
||||
INLINE_MATHUTIL void make_perspective_hfov(FLOATTYPE xfov, FLOATTYPE aspect,
|
||||
FLOATTYPE fnear, FLOATTYPE ffar);
|
||||
INLINE void make_perspective_vfov(FLOATTYPE yfov, FLOATTYPE aspect,
|
||||
INLINE_MATHUTIL void make_perspective_vfov(FLOATTYPE yfov, FLOATTYPE aspect,
|
||||
FLOATTYPE fnear, FLOATTYPE ffar);
|
||||
INLINE void make_perspective(FLOATTYPE xfov, FLOATTYPE yfov, FLOATTYPE fnear,
|
||||
INLINE_MATHUTIL void make_perspective(FLOATTYPE xfov, FLOATTYPE yfov, FLOATTYPE fnear,
|
||||
FLOATTYPE ffar);
|
||||
INLINE void get_perspective_params(FLOATTYPE &yfov, FLOATTYPE &aspect,
|
||||
INLINE_MATHUTIL void get_perspective_params(FLOATTYPE &yfov, FLOATTYPE &aspect,
|
||||
FLOATTYPE &fnear, FLOATTYPE &ffar) const;
|
||||
INLINE void get_perspective_params(FLOATTYPE &xfov, FLOATTYPE &yfov,
|
||||
INLINE_MATHUTIL void get_perspective_params(FLOATTYPE &xfov, FLOATTYPE &yfov,
|
||||
FLOATTYPE &aspect, FLOATTYPE &fnear,
|
||||
FLOATTYPE &ffar) const;
|
||||
|
||||
public:
|
||||
INLINE FLOATNAME(LMatrix4)
|
||||
INLINE_MATHUTIL FLOATNAME(LMatrix4)
|
||||
get_perspective_projection_mat(CoordinateSystem cs = CS_default) const;
|
||||
|
||||
INLINE FLOATNAME(LMatrix4)
|
||||
INLINE_MATHUTIL FLOATNAME(LMatrix4)
|
||||
get_ortho_projection_mat(CoordinateSystem cs = CS_default) const;
|
||||
|
||||
public:
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE GeometricBoundingVolume::
|
||||
INLINE_MATHUTIL GeometricBoundingVolume::
|
||||
GeometricBoundingVolume() {
|
||||
}
|
||||
|
||||
|
|
@ -18,7 +18,7 @@ GeometricBoundingVolume() {
|
|||
// Description: Increases the size of the volume to include the given
|
||||
// volume.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE bool GeometricBoundingVolume::
|
||||
INLINE_MATHUTIL bool GeometricBoundingVolume::
|
||||
extend_by(const GeometricBoundingVolume *vol) {
|
||||
return BoundingVolume::extend_by(vol);
|
||||
}
|
||||
|
|
@ -29,7 +29,7 @@ extend_by(const GeometricBoundingVolume *vol) {
|
|||
// Description: Increases the size of the volume to include the given
|
||||
// point.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE bool GeometricBoundingVolume::
|
||||
INLINE_MATHUTIL bool GeometricBoundingVolume::
|
||||
extend_by(const LPoint3f &point) {
|
||||
return extend_by_point(point);
|
||||
}
|
||||
|
|
@ -40,7 +40,7 @@ extend_by(const LPoint3f &point) {
|
|||
// Description: Resets the volume to enclose only the volumes
|
||||
// indicated.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE bool GeometricBoundingVolume::
|
||||
INLINE_MATHUTIL bool GeometricBoundingVolume::
|
||||
around(const GeometricBoundingVolume **first,
|
||||
const GeometricBoundingVolume **last) {
|
||||
return BoundingVolume::around((const BoundingVolume **)first,
|
||||
|
|
@ -53,7 +53,7 @@ around(const GeometricBoundingVolume **first,
|
|||
// Description: Resets the volume to enclose only the points
|
||||
// indicated.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE bool GeometricBoundingVolume::
|
||||
INLINE_MATHUTIL bool GeometricBoundingVolume::
|
||||
around(const LPoint3f *first, const LPoint3f *last) {
|
||||
_flags = F_empty;
|
||||
if (first != last) {
|
||||
|
|
@ -70,7 +70,7 @@ around(const LPoint3f *first, const LPoint3f *last) {
|
|||
// indicate the amount of intersection with the
|
||||
// indicated volume.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE int GeometricBoundingVolume::
|
||||
INLINE_MATHUTIL int GeometricBoundingVolume::
|
||||
contains(const GeometricBoundingVolume *vol) const {
|
||||
return BoundingVolume::contains(vol);
|
||||
}
|
||||
|
|
@ -82,7 +82,7 @@ contains(const GeometricBoundingVolume *vol) const {
|
|||
// indicate the amount of intersection with the
|
||||
// indicated point.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE int GeometricBoundingVolume::
|
||||
INLINE_MATHUTIL int GeometricBoundingVolume::
|
||||
contains(const LPoint3f &point) const {
|
||||
if (is_empty()) {
|
||||
return IF_no_intersection;
|
||||
|
|
@ -98,7 +98,7 @@ contains(const LPoint3f &point) const {
|
|||
// indicate the amount of intersection with the
|
||||
// indicated line segment.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE int GeometricBoundingVolume::
|
||||
INLINE_MATHUTIL int GeometricBoundingVolume::
|
||||
contains(const LPoint3f &a, const LPoint3f &b) const {
|
||||
if (is_empty()) {
|
||||
return IF_no_intersection;
|
||||
|
|
|
|||
|
|
@ -21,23 +21,23 @@
|
|||
////////////////////////////////////////////////////////////////////
|
||||
class EXPCL_PANDA GeometricBoundingVolume : public BoundingVolume {
|
||||
public:
|
||||
INLINE GeometricBoundingVolume();
|
||||
INLINE_MATHUTIL GeometricBoundingVolume();
|
||||
|
||||
PUBLISHED:
|
||||
INLINE bool extend_by(const GeometricBoundingVolume *vol);
|
||||
INLINE bool extend_by(const LPoint3f &point);
|
||||
INLINE_MATHUTIL bool extend_by(const GeometricBoundingVolume *vol);
|
||||
INLINE_MATHUTIL bool extend_by(const LPoint3f &point);
|
||||
|
||||
// It might be nice to make these template member functions so we
|
||||
// could have true STL-style first/last iterators, but that's
|
||||
// impossible for virtual functions.
|
||||
INLINE bool around(const GeometricBoundingVolume **first,
|
||||
INLINE_MATHUTIL bool around(const GeometricBoundingVolume **first,
|
||||
const GeometricBoundingVolume **last);
|
||||
INLINE bool around(const LPoint3f *first,
|
||||
INLINE_MATHUTIL bool around(const LPoint3f *first,
|
||||
const LPoint3f *last);
|
||||
|
||||
INLINE int contains(const GeometricBoundingVolume *vol) const;
|
||||
INLINE int contains(const LPoint3f &point) const;
|
||||
INLINE int contains(const LPoint3f &a, const LPoint3f &b) const;
|
||||
INLINE_MATHUTIL int contains(const GeometricBoundingVolume *vol) const;
|
||||
INLINE_MATHUTIL int contains(const LPoint3f &point) const;
|
||||
INLINE_MATHUTIL int contains(const LPoint3f &a, const LPoint3f &b) const;
|
||||
|
||||
virtual LPoint3f get_approx_center() const=0;
|
||||
virtual void xform(const LMatrix4f &mat)=0;
|
||||
|
|
|
|||
|
|
@ -3,17 +3,17 @@
|
|||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
INLINE void
|
||||
INLINE_MATHUTIL void
|
||||
heads_up(FLOATNAME(LMatrix3) &mat, const FLOATNAME(LVector3) &fwd, CoordinateSystem cs) {
|
||||
heads_up(mat, fwd, FLOATNAME(LVector3)::up(cs), cs);
|
||||
}
|
||||
|
||||
INLINE void
|
||||
INLINE_MATHUTIL void
|
||||
look_at(FLOATNAME(LMatrix3) &mat, const FLOATNAME(LVector3) &fwd, CoordinateSystem cs) {
|
||||
look_at(mat, fwd, FLOATNAME(LVector3)::up(cs), cs);
|
||||
}
|
||||
|
||||
INLINE void
|
||||
INLINE_MATHUTIL void
|
||||
heads_up(FLOATNAME(LMatrix4) &mat, const FLOATNAME(LVector3) &fwd,
|
||||
const FLOATNAME(LVector3) &up, CoordinateSystem cs) {
|
||||
FLOATNAME(LMatrix3) mat3;
|
||||
|
|
@ -21,7 +21,7 @@ heads_up(FLOATNAME(LMatrix4) &mat, const FLOATNAME(LVector3) &fwd,
|
|||
mat = FLOATNAME(LMatrix4)(mat3);
|
||||
}
|
||||
|
||||
INLINE void
|
||||
INLINE_MATHUTIL void
|
||||
look_at(FLOATNAME(LMatrix4) &mat, const FLOATNAME(LVector3) &fwd,
|
||||
const FLOATNAME(LVector3) &up, CoordinateSystem cs) {
|
||||
FLOATNAME(LMatrix3) mat3;
|
||||
|
|
@ -29,12 +29,12 @@ look_at(FLOATNAME(LMatrix4) &mat, const FLOATNAME(LVector3) &fwd,
|
|||
mat = FLOATNAME(LMatrix4)(mat3);
|
||||
}
|
||||
|
||||
INLINE void
|
||||
INLINE_MATHUTIL void
|
||||
heads_up(FLOATNAME(LMatrix4) &mat, const FLOATNAME(LVector3) &fwd, CoordinateSystem cs) {
|
||||
heads_up(mat, fwd, FLOATNAME(LVector3)::up(cs), cs);
|
||||
}
|
||||
|
||||
INLINE void
|
||||
INLINE_MATHUTIL void
|
||||
look_at(FLOATNAME(LMatrix4) &mat, const FLOATNAME(LVector3) &fwd, CoordinateSystem cs) {
|
||||
look_at(mat, fwd, FLOATNAME(LVector3)::up(cs), cs);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
INLINE FLOATNAME(LMatrix3)
|
||||
INLINE_MATHUTIL FLOATNAME(LMatrix3)
|
||||
make_xi_mat(const FLOATNAME(LVector2) &x) {
|
||||
return FLOATNAME(LMatrix3)(1, 0, 0,
|
||||
0, x[0], x[1],
|
||||
|
|
@ -11,7 +11,7 @@ make_xi_mat(const FLOATNAME(LVector2) &x) {
|
|||
}
|
||||
|
||||
|
||||
INLINE FLOATNAME(LMatrix3)
|
||||
INLINE_MATHUTIL FLOATNAME(LMatrix3)
|
||||
make_x_mat(const FLOATNAME(LVector2) &x) {
|
||||
return FLOATNAME(LMatrix3)(1, 0, 0,
|
||||
0, x[1], x[0],
|
||||
|
|
@ -19,7 +19,7 @@ make_x_mat(const FLOATNAME(LVector2) &x) {
|
|||
}
|
||||
|
||||
|
||||
INLINE FLOATNAME(LMatrix3)
|
||||
INLINE_MATHUTIL FLOATNAME(LMatrix3)
|
||||
make_y_mat(const FLOATNAME(LVector2) &y) {
|
||||
return FLOATNAME(LMatrix3)(y[1], 0, -y[0],
|
||||
0, 1, 0,
|
||||
|
|
@ -27,7 +27,7 @@ make_y_mat(const FLOATNAME(LVector2) &y) {
|
|||
}
|
||||
|
||||
|
||||
INLINE FLOATNAME(LMatrix3)
|
||||
INLINE_MATHUTIL FLOATNAME(LMatrix3)
|
||||
make_z_mat(const FLOATNAME(LVector2) &z) {
|
||||
return FLOATNAME(LMatrix3)(z[1], -z[0], 0,
|
||||
z[0], z[1], 0,
|
||||
|
|
|
|||
|
|
@ -27,22 +27,22 @@ look_at(FLOATNAME(LMatrix3) &mat, const FLOATNAME(LVector3) &fwd,
|
|||
const FLOATNAME(LVector3) &up = FLOATNAME(LVector3)::up(),
|
||||
CoordinateSystem cs = CS_default);
|
||||
|
||||
INLINE void heads_up(FLOATNAME(LMatrix3) &mat, const FLOATNAME(LVector3) &fwd,
|
||||
INLINE_MATHUTIL void heads_up(FLOATNAME(LMatrix3) &mat, const FLOATNAME(LVector3) &fwd,
|
||||
CoordinateSystem cs);
|
||||
INLINE void look_at(FLOATNAME(LMatrix3) &mat, const FLOATNAME(LVector3) &fwd,
|
||||
INLINE_MATHUTIL void look_at(FLOATNAME(LMatrix3) &mat, const FLOATNAME(LVector3) &fwd,
|
||||
CoordinateSystem cs);
|
||||
|
||||
|
||||
INLINE void heads_up(FLOATNAME(LMatrix4) &mat, const FLOATNAME(LVector3) &fwd,
|
||||
INLINE_MATHUTIL void heads_up(FLOATNAME(LMatrix4) &mat, const FLOATNAME(LVector3) &fwd,
|
||||
const FLOATNAME(LVector3) &up = FLOATNAME(LVector3)::up(),
|
||||
CoordinateSystem cs = CS_default);
|
||||
INLINE void look_at(FLOATNAME(LMatrix4) &mat, const FLOATNAME(LVector3) &fwd,
|
||||
INLINE_MATHUTIL void look_at(FLOATNAME(LMatrix4) &mat, const FLOATNAME(LVector3) &fwd,
|
||||
const FLOATNAME(LVector3) &up = FLOATNAME(LVector3)::up(),
|
||||
CoordinateSystem cs = CS_default);
|
||||
|
||||
INLINE void heads_up(FLOATNAME(LMatrix4) &mat, const FLOATNAME(LVector3) &fwd,
|
||||
INLINE_MATHUTIL void heads_up(FLOATNAME(LMatrix4) &mat, const FLOATNAME(LVector3) &fwd,
|
||||
CoordinateSystem cs);
|
||||
INLINE void look_at(FLOATNAME(LMatrix4) &mat, const FLOATNAME(LVector3) &fwd,
|
||||
INLINE_MATHUTIL void look_at(FLOATNAME(LMatrix4) &mat, const FLOATNAME(LVector3) &fwd,
|
||||
CoordinateSystem cs);
|
||||
|
||||
END_PUBLISH
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
////////////////////////////////////////////////////////////////////
|
||||
#include <math.h>
|
||||
|
||||
INLINE float distance(const LPoint3f &pos0, const LPoint3f &pos1) {
|
||||
INLINE_MATHUTIL float distance(const LPoint3f &pos0, const LPoint3f &pos1) {
|
||||
LVector3f v = pos0 - pos1;
|
||||
return length(v);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
BEGIN_PUBLISH
|
||||
|
||||
INLINE float distance(const LPoint3f &pos0, const LPoint3f &pos1);
|
||||
INLINE_MATHUTIL float distance(const LPoint3f &pos0, const LPoint3f &pos1);
|
||||
|
||||
END_PUBLISH
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE OmniBoundingVolume::
|
||||
INLINE_MATHUTIL OmniBoundingVolume::
|
||||
OmniBoundingVolume() {
|
||||
_flags = F_infinite;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
////////////////////////////////////////////////////////////////////
|
||||
class EXPCL_PANDA OmniBoundingVolume : public GeometricBoundingVolume {
|
||||
PUBLISHED:
|
||||
INLINE OmniBoundingVolume();
|
||||
INLINE_MATHUTIL OmniBoundingVolume();
|
||||
|
||||
public:
|
||||
virtual BoundingVolume *make_copy() const;
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
// intersect the origin, perpendicular to the Z axis.
|
||||
// It's not clear how useful a default plane is.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(Plane)::
|
||||
INLINE_MATHUTIL FLOATNAME(Plane)::
|
||||
FLOATNAME(Plane)(void) {
|
||||
_a = 0.0;
|
||||
_b = 0.0;
|
||||
|
|
@ -23,7 +23,7 @@ FLOATNAME(Plane)(void) {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(Plane)::
|
||||
INLINE_MATHUTIL FLOATNAME(Plane)::
|
||||
FLOATNAME(Plane)(const FLOATNAME(Plane) ©) :
|
||||
_a(copy._a),
|
||||
_b(copy._b),
|
||||
|
|
@ -40,7 +40,7 @@ FLOATNAME(Plane)(const FLOATNAME(Plane) ©) :
|
|||
// viewed from the end of the normal vector, looking
|
||||
// down).
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(Plane)::
|
||||
INLINE_MATHUTIL FLOATNAME(Plane)::
|
||||
FLOATNAME(Plane)(const FLOATNAME(LPoint3) &a, const FLOATNAME(LPoint3) &b,
|
||||
const FLOATNAME(LPoint3) &c) {
|
||||
FLOATNAME(LVector3) u = b - a;
|
||||
|
|
@ -59,7 +59,7 @@ FLOATNAME(Plane)(const FLOATNAME(LPoint3) &a, const FLOATNAME(LPoint3) &b,
|
|||
// Description: Constructs a plane given a surface normal vector and
|
||||
// a point within the plane.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(Plane)::
|
||||
INLINE_MATHUTIL FLOATNAME(Plane)::
|
||||
FLOATNAME(Plane)(const FLOATNAME(LVector3) &normal, const FLOATNAME(LPoint3) &point) {
|
||||
FLOATNAME(LVector3) p = normalize(normal);
|
||||
|
||||
|
|
@ -74,7 +74,7 @@ FLOATNAME(Plane)(const FLOATNAME(LVector3) &normal, const FLOATNAME(LPoint3) &po
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(Plane)& FLOATNAME(Plane)::
|
||||
INLINE_MATHUTIL FLOATNAME(Plane)& FLOATNAME(Plane)::
|
||||
operator = (const FLOATNAME(Plane)& p) {
|
||||
_a = p._a;
|
||||
_b = p._b;
|
||||
|
|
@ -88,7 +88,7 @@ operator = (const FLOATNAME(Plane)& p) {
|
|||
// Access: Public
|
||||
// Description: Transforms the plane by the indicated matrix.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(Plane) FLOATNAME(Plane)::
|
||||
INLINE_MATHUTIL FLOATNAME(Plane) FLOATNAME(Plane)::
|
||||
operator * (const FLOATNAME(LMatrix3) &mat) const {
|
||||
FLOATNAME(LVector3) new_normal = get_normal() * mat;
|
||||
FLOATNAME(LPoint3) new_point = get_point() * mat;
|
||||
|
|
@ -100,7 +100,7 @@ operator * (const FLOATNAME(LMatrix3) &mat) const {
|
|||
// Access: Public
|
||||
// Description: Transforms the plane by the indicated matrix.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(Plane) FLOATNAME(Plane)::
|
||||
INLINE_MATHUTIL FLOATNAME(Plane) FLOATNAME(Plane)::
|
||||
operator * (const FLOATNAME(LMatrix4) &mat) const {
|
||||
FLOATNAME(LVector3) new_normal = get_normal() * mat;
|
||||
FLOATNAME(LPoint3) new_point = get_point() * mat;
|
||||
|
|
@ -112,7 +112,7 @@ operator * (const FLOATNAME(LMatrix4) &mat) const {
|
|||
// Access: Public
|
||||
// Description: Returns the surface normal of the plane.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATNAME(LVector3) FLOATNAME(Plane)::
|
||||
INLINE_MATHUTIL FLOATNAME(LVector3) FLOATNAME(Plane)::
|
||||
get_normal() const {
|
||||
return FLOATNAME(LVector3)(_a, _b, _c);
|
||||
}
|
||||
|
|
@ -127,7 +127,7 @@ get_normal() const {
|
|||
// the plane (on the opposite side from the normal).
|
||||
// It's zero if the point is exactly in the plane.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE FLOATTYPE FLOATNAME(Plane)::
|
||||
INLINE_MATHUTIL FLOATTYPE FLOATNAME(Plane)::
|
||||
dist_to_plane(const FLOATNAME(LPoint3) &point) const {
|
||||
return (_a * point[0] + _b * point[1] + _c * point[2] + _d);
|
||||
}
|
||||
|
|
@ -142,7 +142,7 @@ dist_to_plane(const FLOATNAME(LPoint3) &point) const {
|
|||
// bearing on the intersection test. If true, sets
|
||||
// intersection_point to the point of intersection.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE bool FLOATNAME(Plane)::
|
||||
INLINE_MATHUTIL bool FLOATNAME(Plane)::
|
||||
intersects_line(FLOATNAME(LPoint3) &intersection_point,
|
||||
const FLOATNAME(LPoint3) &p1,
|
||||
const FLOATNAME(LPoint3) &p2) const {
|
||||
|
|
@ -171,7 +171,7 @@ intersects_line(FLOATNAME(LPoint3) &intersection_point,
|
|||
// point from, and t == 1.0 implies at point from +
|
||||
// delta, with other values of t accordingly.
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE bool FLOATNAME(Plane)::
|
||||
INLINE_MATHUTIL bool FLOATNAME(Plane)::
|
||||
intersects_line(FLOATTYPE &t,
|
||||
const FLOATNAME(LPoint3) &from,
|
||||
const FLOATNAME(LVector3) &delta) const {
|
||||
|
|
@ -189,7 +189,7 @@ intersects_line(FLOATTYPE &t,
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void FLOATNAME(Plane)::
|
||||
INLINE_MATHUTIL void FLOATNAME(Plane)::
|
||||
output(ostream &out) const {
|
||||
out << "Plane(" << _a << " " << _b << " " << _c << " " << _d << ")";
|
||||
}
|
||||
|
|
@ -199,7 +199,7 @@ output(ostream &out) const {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void FLOATNAME(Plane)::
|
||||
INLINE_MATHUTIL void FLOATNAME(Plane)::
|
||||
write(ostream &out, int indent_level) const {
|
||||
indent(out, indent_level) << *this << "\n";
|
||||
}
|
||||
|
|
@ -209,7 +209,7 @@ write(ostream &out, int indent_level) const {
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void FLOATNAME(Plane)::
|
||||
INLINE_MATHUTIL void FLOATNAME(Plane)::
|
||||
write_datagram(Datagram &dest)
|
||||
{
|
||||
dest.add_float32(_a);
|
||||
|
|
@ -223,7 +223,7 @@ write_datagram(Datagram &dest)
|
|||
// Access: Public
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE void FLOATNAME(Plane)::
|
||||
INLINE_MATHUTIL void FLOATNAME(Plane)::
|
||||
read_datagram(DatagramIterator &source)
|
||||
{
|
||||
_a = source.get_float32();
|
||||
|
|
|
|||
|
|
@ -9,43 +9,43 @@
|
|||
////////////////////////////////////////////////////////////////////
|
||||
class EXPCL_PANDA FLOATNAME(Plane) {
|
||||
PUBLISHED:
|
||||
INLINE FLOATNAME(Plane)(void);
|
||||
INLINE FLOATNAME(Plane)(const FLOATNAME(Plane) ©);
|
||||
INLINE FLOATNAME(Plane)(const FLOATNAME(LPoint3) &a, const FLOATNAME(LPoint3) &b,
|
||||
INLINE_MATHUTIL FLOATNAME(Plane)(void);
|
||||
INLINE_MATHUTIL FLOATNAME(Plane)(const FLOATNAME(Plane) ©);
|
||||
INLINE_MATHUTIL FLOATNAME(Plane)(const FLOATNAME(LPoint3) &a, const FLOATNAME(LPoint3) &b,
|
||||
const FLOATNAME(LPoint3) &c);
|
||||
INLINE FLOATNAME(Plane)(const FLOATNAME(LVector3) &normal,
|
||||
INLINE_MATHUTIL FLOATNAME(Plane)(const FLOATNAME(LVector3) &normal,
|
||||
const FLOATNAME(LPoint3) &point);
|
||||
|
||||
INLINE FLOATNAME(Plane)& operator = (const FLOATNAME(Plane)& copy);
|
||||
INLINE_MATHUTIL FLOATNAME(Plane)& operator = (const FLOATNAME(Plane)& copy);
|
||||
|
||||
INLINE FLOATNAME(Plane) operator * (const FLOATNAME(LMatrix3) &mat) const;
|
||||
INLINE FLOATNAME(Plane) operator * (const FLOATNAME(LMatrix4) &mat) const;
|
||||
INLINE_MATHUTIL FLOATNAME(Plane) operator * (const FLOATNAME(LMatrix3) &mat) const;
|
||||
INLINE_MATHUTIL FLOATNAME(Plane) operator * (const FLOATNAME(LMatrix4) &mat) const;
|
||||
|
||||
FLOATNAME(LMatrix4) get_reflection_mat(void) const;
|
||||
|
||||
INLINE FLOATNAME(LVector3) get_normal() const;
|
||||
INLINE_MATHUTIL FLOATNAME(LVector3) get_normal() const;
|
||||
FLOATNAME(LPoint3) get_point() const;
|
||||
|
||||
INLINE FLOATTYPE dist_to_plane(const FLOATNAME(LPoint3) &point) const;
|
||||
INLINE bool intersects_line(FLOATNAME(LPoint3) &intersection_point,
|
||||
INLINE_MATHUTIL FLOATTYPE dist_to_plane(const FLOATNAME(LPoint3) &point) const;
|
||||
INLINE_MATHUTIL bool intersects_line(FLOATNAME(LPoint3) &intersection_point,
|
||||
const FLOATNAME(LPoint3) &p1,
|
||||
const FLOATNAME(LPoint3) &p2) const;
|
||||
INLINE bool intersects_line(FLOATTYPE &t,
|
||||
INLINE_MATHUTIL bool intersects_line(FLOATTYPE &t,
|
||||
const FLOATNAME(LPoint3) &from,
|
||||
const FLOATNAME(LVector3) &delta) const;
|
||||
|
||||
INLINE void output(ostream &out) const;
|
||||
INLINE void write(ostream &out, int indent_level = 0) const;
|
||||
INLINE_MATHUTIL void output(ostream &out) const;
|
||||
INLINE_MATHUTIL void write(ostream &out, int indent_level = 0) const;
|
||||
|
||||
public:
|
||||
INLINE void write_datagram(Datagram &dest);
|
||||
INLINE void read_datagram(DatagramIterator &source);
|
||||
INLINE_MATHUTIL void write_datagram(Datagram &dest);
|
||||
INLINE_MATHUTIL void read_datagram(DatagramIterator &source);
|
||||
|
||||
public:
|
||||
FLOATTYPE _a, _b, _c, _d;
|
||||
};
|
||||
|
||||
INLINE ostream &operator << (ostream &out, const FLOATNAME(Plane) &p) {
|
||||
INLINE_MATHUTIL ostream &operator << (ostream &out, const FLOATNAME(Plane) &p) {
|
||||
p.output(out);
|
||||
return out;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue