4 #ifndef INCLUDE_VECTOR_H
6 # define INCLUDE_VECTOR_H
15 Face() : a( 0 ), b( 0 ), c( 0 ) {}
17 Face(
unsigned short fa,
unsigned short fb,
unsigned short fc )
23 unsigned short a, b, c;
28 const float deg2rad = 3.1415926535f / 180.0f;
29 const float rad2deg = 180.0f / 3.1415926535f;
30 const float tolerance = 0.00001f;
31 const float pi = 3.1415926535f;
38 bool AlmostEquals(
float f1,
float f2 );
45 unsigned short ConvertF32ToF16(
float valueToConvert );
54 void GetMinMax(
const std::vector< Vec3 >& points,
Vec3& outMin,
Vec3& outMax );
63 void GetCorners(
const Vec3& min,
const Vec3& max, std::vector< Vec3 >& outCorners );
66 float Floor(
float f );
69 float Ceil(
float f );
72 float Round(
float f );
82 float Lerp(
float start,
float end,
float amount );
91 float Random(
float aMin,
float aMax );
103 float Remap(
float value,
float oldMin,
float oldMax,
float newMin,
float newMax );
112 bool IsNaN(
float f );
120 bool IsPowerOfTwo(
unsigned i );
122 template<
typename T >
125 return t1 < t2 ? t1 : t2;
128 template<
typename T >
131 return t1 > t2 ? t1 : t2;
143 float IntersectRayAABB(
const Vec3& origin,
const Vec3& target,
const Vec3& min,
const Vec3& max );
154 bool IntersectSphereAndAABB(
const Vec3& sphereOrigin,
float sphereRadius,
const Vec3& aabbMin,
const Vec3& aabbMax );
165 bool IntersectAABBandAABB(
const Vec3& aabb1Min,
const Vec3& aabb1Max,
const Vec3& aabb2Min,
const Vec3& aabb2Max );
175 float IntersectRayTriangles(
const Vec3& origin,
const Vec3& target,
const std::vector< Vec3 >& vertices,
const std::vector< Face >& faces );