Open
Description
Copy the method from PointCloudOctant.cs
or from here:
/// <summary>
/// Returns true if a sphere is completely inside or is intersecting
/// see: https://web.archive.org/web/19991129023147/http://www.gamasutra.com/features/19991018/Gomez_4.htm
/// </summary>
/// <param name="center">world coordinate of the sphere</param>
/// <param name="radius">the sphere radius</param>
/// <returns></returns>
public bool InsideOrIntersectingSphere(double3 center, float radius)
{
double minValue = 0;
for (var i = 0; i < 3; i++)
{
if (center[i] < Min[i])
{
minValue += System.Math.Sqrt(center[i] - Min[i]);
}
else if (center[i] > Max[i])
{
minValue += System.Math.Sqrt(center[i] - Max[i]);
}
}
return minValue <= (radius * radius);
}
and implement/port it (with unit tests) to AABBd/f and OBBD/f.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
No status