This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// CatmullRomCurveProjectPt() | |
// | |
// | |
//******************************************************************************************* | |
template <typename T> | |
T CatmullRomCurveProjectPt( const CVector2<T> &p0, | |
const CVector2<T> &p1, | |
const CVector2<T> &p2, | |
const CVector2<T> &p3, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// CatmullRomLength() | |
// | |
// | |
//******************************************************************************************* | |
template <typename T> | |
T CatmullRomLength( const CVector2<T> &p0, | |
const CVector2<T> &p1, | |
const CVector2<T> &p2, | |
const CVector2<T> &p3, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// CatmullRomBoundinBox2D() | |
// | |
// | |
//********************************************************************************************* | |
template <typename T_Vec2> | |
void CatmullRomBoundingBox2D(const T_Vec2 ctrlPts[4], T_Vec2 &min, T_Vec2 &max) | |
{ | |
// See this for description of concept: | |
// https://stackoverflow.com/questions/24809978/calculating-the-bounding-box-of-cubic-bezier-curve |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static NX_FORCEINLINE float FastPow2_P2(float p) | |
{ | |
// 2^x = 2^xi * 2^xf | |
// pow2f - polynomial approximation of e(x) on <0, 1) range | |
const float pi = floorf(p); | |
const float pf = p - pi; | |
const float pow2i = UIntAsFloat((1 << 23) * ((int)pi + 127)); | |
float pow2f = 3.4400110689651967e-1f; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static NX_FORCEINLINE float FastLog2_P2(float a) | |
{ | |
// Based on code by Norbert Juffa | |
// r = log2(1 + m) for m in [sqrt(0.5) - 1, sqrt(2.0) - 1] range | |
const int e = (FloatAsUInt(a) - 0x3f3504f3) & 0xff800000; | |
const float m = UIntAsFloat(FloatAsUInt(a) - e) - 1.0f; | |
const float i = (float)e * 1.19209290e-7f; | |
float r = -6.8969686599880982e-1f; |