Added Area.h
This commit is contained in:
@@ -261,19 +261,19 @@ namespace hgl
|
||||
return from + (to - from) * alpha;
|
||||
}
|
||||
|
||||
inline bool is_nearly_equal(const float v1,const float v2,const float deviation=HGL_FLOAT_SMALL)
|
||||
inline bool is_nearly_equal(const float v1,const float v2,const float deviation=HGL_FLOAT_KINDA_SMALL)
|
||||
{
|
||||
return fabsf(v1-v2)<=HGL_FLOAT_SMALL;
|
||||
return fabsf(v1-v2)<=deviation;
|
||||
}
|
||||
|
||||
inline bool is_nearly_equal(const Vector2f &v1,const Vector2f &v2,const float deviation=HGL_FLOAT_SMALL)
|
||||
inline bool is_nearly_equal(const Vector2f &v1,const Vector2f &v2,const float deviation=HGL_FLOAT_KINDA_SMALL)
|
||||
{
|
||||
return length_squared_2d(v1,v2)<=HGL_FLOAT_SMALL;
|
||||
return length_squared_2d(v1,v2)<=deviation;
|
||||
}
|
||||
|
||||
inline bool is_nearly_equal(const Vector3f &v1,const Vector3f &v2,const float deviation=HGL_FLOAT_SMALL)
|
||||
inline bool is_nearly_equal(const Vector3f &v1,const Vector3f &v2,const float deviation=HGL_FLOAT_KINDA_SMALL)
|
||||
{
|
||||
return length_squared(v1,v2)<=HGL_FLOAT_SMALL;
|
||||
return length_squared(v1,v2)<=deviation;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -413,5 +413,15 @@ namespace hgl
|
||||
&&IsNearlyEqual(a.y,b.y)
|
||||
&&IsNearlyEqual(a.z,b.z);
|
||||
}
|
||||
|
||||
inline const Vector3f LerpDirection(const Vector3f ¢er,const Vector3f &from_direction,const Vector3f &to_direction,const float alpha)
|
||||
{
|
||||
return glm::normalize(center + (from_direction - center) * alpha + (to_direction - center) * alpha);
|
||||
}
|
||||
|
||||
inline const Vector3f SLerpDirection(const Vector3f ¢er,const Vector3f &from,const Vector3f &to,const float alpha)
|
||||
{
|
||||
return glm::normalize(glm::slerp(from - center, to - center, alpha) + center);
|
||||
}
|
||||
}//namespace hgl
|
||||
#endif//HGL_ALGORITHM_MATH_VECTOR_INCLUDE
|
||||
|
Reference in New Issue
Block a user