This commit is contained in:
aozhiwei 2019-07-10 18:02:22 +08:00
parent 88b75d811a
commit 287a824201
2 changed files with 25 additions and 0 deletions

View File

@ -92,6 +92,29 @@ namespace a8
return n < t*t;
}
bool IntersectSectorCircle(a8::Vec2 a_pos, float angle, float a_rad, a8::Vec2 b_pos, float b_rad)
{
{
a8::Vec2 d = b_pos - a_pos;
float n = a8::LengthSqr(d);
if (n < a_rad || n < b_rad) {
return true;
}
if (n > a_rad + b_rad) {
return false;
}
}
{
}
return false;
}
bool IntersectSectorAabb(a8::Vec2 a_pos, float angle, float a_rad, a8::Vec2 b_min, a8::Vec2 b_max)
{
return false;
}
bool CircleContainCircle(a8::Vec2 a_pos, float a_rad, a8::Vec2 b_pos, float b_rad)
{
float distance = (a_pos - b_pos).Norm();

View File

@ -10,6 +10,8 @@ namespace a8
bool IntersectAabbCircle(a8::Vec2 a_min, a8::Vec2 a_max, a8::Vec2 b_pos, float b_rad);
bool IntersectAabbAabb(a8::Vec2 a_min, a8::Vec2 a_max, a8::Vec2 b_min, a8::Vec2 b_max);
bool IntersectCircleCircle(a8::Vec2 a_pos, float a_rad, a8::Vec2 b_pos, float b_rad);
bool IntersectSectorCircle(a8::Vec2 a_pos, float angle, float a_rad, a8::Vec2 b_pos, float b_rad);
bool IntersectSectorAabb(a8::Vec2 a_pos, float angle, float a_rad, a8::Vec2 b_min, a8::Vec2 b_max);
bool CircleContainCircle(a8::Vec2 a_pos, float a_rad, a8::Vec2 b_pos, float b_rad);
bool CalcCircleAabbSafePoint(a8::Vec2 a_pos, float a_rad, a8::Vec2 b_min, a8::Vec2 b_max,
a8::Vec2& new_pos);