fix aabb <-> aabb bug
This commit is contained in:
commit
62cad93ca2
@ -80,8 +80,9 @@ namespace a8
|
|||||||
a8::Vec2 b_v = (b_max - b_min) * 0.5f;
|
a8::Vec2 b_v = (b_max - b_min) * 0.5f;
|
||||||
a8::Vec2 b_center = b_min + b_v;
|
a8::Vec2 b_center = b_min + b_v;
|
||||||
a8::Vec2 z = b_center - a_center;
|
a8::Vec2 z = b_center - a_center;
|
||||||
float u = a_v.x + b_v.x - std::abs(z.x);
|
float u1 = a_v.x + b_v.x - std::abs(z.x);
|
||||||
return u > 0;
|
float u2 = a_v.y + b_v.y - std::abs(z.y);
|
||||||
|
return u1 > 0 && u2 > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IntersectCircleCircle(a8::Vec2 a_pos, float a_rad, a8::Vec2 b_pos, float b_rad)
|
bool IntersectCircleCircle(a8::Vec2 a_pos, float a_rad, a8::Vec2 b_pos, float b_rad)
|
||||||
|
@ -76,6 +76,12 @@ namespace a8
|
|||||||
return a1 / 3.1415926f;
|
return a1 / 3.1415926f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float Vec2::CalcAngleEx(const Vec2& b)
|
||||||
|
{
|
||||||
|
float a1 = acos(Dot(b) / Norm() / b.Norm());
|
||||||
|
return a1 / 3.1415926f;
|
||||||
|
}
|
||||||
|
|
||||||
Vec2 Vec2::FromAngle(float angle)
|
Vec2 Vec2::FromAngle(float angle)
|
||||||
{
|
{
|
||||||
Vec2 vec2;
|
Vec2 vec2;
|
||||||
|
@ -13,6 +13,7 @@ namespace a8
|
|||||||
void Normalize();
|
void Normalize();
|
||||||
void Rotate(float angle);
|
void Rotate(float angle);
|
||||||
float CalcAngle(const Vec2& b);
|
float CalcAngle(const Vec2& b);
|
||||||
|
float CalcAngleEx(const Vec2& b);
|
||||||
static Vec2 FromAngle(float angle);
|
static Vec2 FromAngle(float angle);
|
||||||
float Distance(const Vec2& b);
|
float Distance(const Vec2& b);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user