Routines to support line rendering

This commit is contained in:
Jack Andersen 2016-02-17 16:40:58 -10:00
parent b4ed5b78dc
commit a857250ccf
3 changed files with 15 additions and 1 deletions

View File

@ -255,6 +255,11 @@ public:
return *this * mag; return *this * mag;
} }
inline CVector2f perpendicularVector() const
{
return {-y, x};
}
inline float cross(const CVector2f& rhs) const inline float cross(const CVector2f& rhs) const
{ {
return (x * rhs.y) - (y * rhs.x); return (x * rhs.y) - (y * rhs.x);

View File

@ -91,6 +91,15 @@ public:
v[3] = 0.0f; v[3] = 0.0f;
} }
inline CVector2f toVec2f() const
{
#if __SSE__
return CVector2f(mVec128);
#else
return CVector2f(x, y);
#endif
}
inline bool operator ==(const CVector3f& rhs) const inline bool operator ==(const CVector3f& rhs) const
{return (x == rhs.x && y == rhs.y && z == rhs.z);} {return (x == rhs.x && y == rhs.y && z == rhs.z);}
inline bool operator !=(const CVector3f& rhs) const inline bool operator !=(const CVector3f& rhs) const

View File

@ -134,7 +134,6 @@ double sqrtD(double val)
p.v *= (1.5f - (x * p.v * p.v)); p.v *= (1.5f - (x * p.v * p.v));
p.v *= (1.5f - (x * p.v * p.v)); p.v *= (1.5f - (x * p.v * p.v));
q = p.v; q = p.v;
#endif
static const double half = 0.5; static const double half = 0.5;
static const double three = 3.0; static const double three = 3.0;
@ -155,6 +154,7 @@ double sqrtD(double val)
sq = -((val * three) - sq); sq = -((val * three) - sq);
sq = q * sq; sq = q * sq;
q = val * sq; q = val * sq;
#endif
return q; return q;
} }