소스 검색

Fixed geometry stupidity calculations

undefined
Benjamin ‘Touky’ Huet Sam Hocevar <sam@hocevar.net> 10 년 전
부모
커밋
706766893f
1개의 변경된 파일11개의 추가작업 그리고 11개의 파일을 삭제
  1. +11
    -11
      src/lol/math/geometry.h

+ 11
- 11
src/lol/math/geometry.h 파일 보기

@@ -181,12 +181,12 @@ bool operator>=(float value, const TestEpsilon& epsilon);
//--
static inline bool TestAABBVsAABB(box2 const &b1, box2 const &b2)
{
vec2 dist = 0.5f * (b1.A - b2.A + b1.B - b2.B);
vec2 e1 = 0.5f * (b1.B - b1.A);
vec2 e2 = 0.5f * (b2.B - b2.A);
vec2 c = 0.5f * ((b1.A + b1.B) - (b2.A + b2.B));
vec2 e1 = 0.5f * (b1.B - b1.A);
vec2 e2 = 0.5f * (b2.B - b2.A);

return abs(dist.x) <= abs(e1.x) + abs(e2.x)
&& abs(dist.y) <= abs(e1.y) + abs(e2.y);
return abs(c.x) <= e1.x + e2.x
&& abs(c.y) <= e1.y + e2.y;
}
static inline bool TestAABBVsPoint(box2 const &b1, vec2 const &p)
{
@@ -195,13 +195,13 @@ static inline bool TestAABBVsPoint(box2 const &b1, vec2 const &p)

static inline bool TestAABBVsAABB(box3 const &b1, box3 const &b2)
{
vec3 dist = 0.5f * (b1.A - b2.A + b1.B - b2.B);
vec3 e1 = 0.5f * (b1.B - b1.A);
vec3 e2 = 0.5f * (b2.B - b2.A);
vec3 c = 0.5f * ((b1.A + b1.B) - (b2.A + b2.B));
vec3 e1 = 0.5f * (b1.B - b1.A);
vec3 e2 = 0.5f * (b2.B - b2.A);

return abs(dist.x) <= abs(e1.x) + abs(e2.x)
&& abs(dist.y) <= abs(e1.y) + abs(e2.y)
&& abs(dist.z) <= abs(e1.z) + abs(e2.z);
return abs(c.x) <= e1.x + e2.x
&& abs(c.y) <= e1.y + e2.y
&& abs(c.z) <= e1.z + e2.z;
}
static inline bool TestAABBVsPoint(box3 const &b1, vec3 const &p)
{


불러오는 중...
취소
저장