29 namespace OpenSkyNet {
32 template<
class T=
float,
unsigned char U=3>
37 Point(
const T& x_=0,
const T& y_=0,
const T& z_=0) {
57 for (
unsigned char i = 0; i < U; ++i)
87 for (
unsigned char i = 0; i < U; ++i)
95 for (
unsigned char i = 0; i < U; ++i)
104 for (
unsigned char i = 0; i < U; ++i)
112 for (
unsigned char i = 1; i < U; ++i)
121 for (
unsigned char i = 1; i < U; ++i)
130 for (
unsigned char i = 0; i < U; ++i)
142 T len =
static_cast<T
>(sqrt(lensqrd));
143 for (
unsigned char i = 0; i < U; ++i)
153 if ((rhs_ - *
this).
getLenSqrd() > radiusSqrd_)
160 for (
unsigned char i = 0; i < U; ++i)
167 for (
unsigned char i = 0; i < U; ++i)
174 for (
unsigned char i = 0; i < U; ++i)
184 for (
unsigned char i = 0; i < U; ++i)
191 for (
unsigned char i = 0; i < U; ++i)
198 return Point<T>(
y()*rhs_.
z() -
z()*rhs_.
y(),
z()*rhs_.
x() -
x()*rhs_.
z(),
x()*rhs_.
y() -
y()*rhs_.
x());
203 return (
x()*rhs_.
x() +
y()*rhs_.
y() +
z()*rhs_.
z());
209 return *
this - (projection * 2.f);
220 template<
class T,
class U>
233 template<
class T,
class U>
237 template<
class T,
class U>
241 for (
unsigned char i = 0; i < dimensToAdd; ++i)
247 template<
class T,
class U>
251 template<
class T,
class U>
255 for (
unsigned char i = 0; i < dimensToMul; ++i)
261 template<
class T,
class U>
265 for (
unsigned char i = 0; i < dimensToDiv; ++i)
271 template<
class T,
class U>
280 template<
class T,
class U>
289 template<
class T,
class U>
297 template<
class T,
class U>
299 Math::clamp<float>(amount_);
300 return Point<T>((lhs_ * (1.0f - amount_)) + (rhs_ * amount_));
312 const float radiusSqrd = radius_ * radius_;
315 for (
int n = 0; n < 20; ++n) {
327 p.
x() = radius_ * dist * cosf(rads);
328 p.
y() = radius_ * dist * sinf(rads);
const T & r() const
Definition: MPoint.h:75
T getComponentSum() const
Definition: MPoint.h:102
const T & b() const
Definition: MPoint.h:77
T getMin() const
Definition: MPoint.h:119
Matrix3x3 operator*(const Matrix3x3 &lhs_, const Matrix3x3 &rhs_)
Definition: MMatrix3x3.h:208
Commmon math functions and constants.
T getLength() const
Definition: MPoint.h:136
const T & z() const
Definition: MPoint.h:74
void normalize()
Definition: MPoint.h:139
Point< T > getAbs() const
Definition: MPoint.h:93
Point< T, U > & operator=(const Point< T, U > &rhs_)
Definition: MPoint.h:159
const T & a() const
Definition: MPoint.h:78
T & y()
Definition: MPoint.h:65
T getLenSqrd() const
Definition: MPoint.h:128
T & x()
Definition: MPoint.h:64
Point< float, 2 > RandPointInOrOnCircle(float radius_)
Definition: MPoint.h:310
Point< T > & operator+=(const Point< T > &rhs_)
Definition: MPoint.h:166
T & operator[](int i_)
Definition: MPoint.h:71
const Point g_yAxis(0.0f, 1.0f, 0.0f)
Definition: MPoint.h:216
Point< T > operator-() const
Definition: MPoint.h:85
Point(const Point< T > &p_)
Definition: MPoint.h:56
const T & operator[](int i_) const
Definition: MPoint.h:79
Point< T > & operator-=(const T &rhs_)
Definition: MPoint.h:183
const T & x() const
Definition: MPoint.h:72
bool operator==(const Point< T > &lhs_, const Point< U > &rhs_)
Definition: MPoint.h:221
const Point g_origin
Definition: MPoint.cpp:5
Point< T > & operator-=(const Point< T > &rhs_)
Definition: MPoint.h:180
Point< T > & operator*=(const T &rhs_)
Definition: MPoint.h:190
T & r()
Definition: MPoint.h:67
bool equals(const Point< T > &rhs_, T radiusSqrd_) const
Definition: MPoint.h:152
bool operator!=(const Point< T > &lhs_, const Point< U > &rhs_)
Definition: MPoint.h:234
Point< T > operator+(const Point< T > &lhs_, const Point< U > &rhs_)
Definition: MPoint.h:238
Point< T > operator-(const Point< T > &lhs_, const Point< U > &rhs_)
Definition: MPoint.h:248
T & a()
Definition: MPoint.h:70
T & z()
Definition: MPoint.h:66
unsigned char getNumDimensions() const
Definition: MPoint.h:63
const T & g() const
Definition: MPoint.h:76
Point< T > getReflection3(const Point< T > &n_) const
Definition: MPoint.h:207
const Point g_xAxis(1.0f, 0.0f, 0.0f)
Definition: MPoint.h:215
T getLength(const Point< T > &lhs_, const Point< U > &rhs_)
Definition: MPoint.h:290
Point< T > interpolate(const Point< T > &lhs_, const Point< U > &rhs_, float amount_)
Definition: MPoint.h:298
T & b()
Definition: MPoint.h:69
const T & y() const
Definition: MPoint.h:73
const Point g_zAxis(0.0f, 0.0f, 1.0f)
Definition: MPoint.h:217
float randNeg1Pos1()
Definition: MFun.h:60
T getDot3(const Point< T > &rhs_) const
Definition: MPoint.h:202
Point< T > getCross3(const Point< T > &rhs_) const
Definition: MPoint.h:197
Point< T > & operator+=(const T &rhs_)
Definition: MPoint.h:173
const float PI(3.14159265f)
T & g()
Definition: MPoint.h:68
Point< T > operator/(const Point< T > &lhs_, const Point< U > &rhs_)
Definition: MPoint.h:262
Point(const T &x_=0, const T &y_=0, const T &z_=0)
Definition: MPoint.h:37
T _dimensions[U]
Definition: MPoint.h:35
T getMax() const
Definition: MPoint.h:110
float rand01()
Definition: MFun.h:57