Function intrSphereVsTriangle

Checks sphere and triangle for intersection

Intersection intrSphereVsTriangle (
  ref Sphere sphere,
  ref Triangle tri
);

Example

Sphere sphere = Sphere(Vector3f(0, 0.9f, 0), 1.0f);

Triangle tri;
tri.v = [
    Vector3f(0.5f, 0, -0.5f),
    Vector3f(-0.5f, 0, -0.5f),
    Vector3f(0, 0, 0.5f)
];
tri.normal = Vector3f(0, 1, 0);
tri.d = 0.0f;

Intersection isec = intrSphereVsTriangle(sphere, tri);
assert(isec.fact);
assert(isConsiderZero(isec.penetrationDepth - 0.1f));
assert(isAlmostZero(isec.point - Vector3f(0.0f, -0.1f, 0.0f)));
assert(isAlmostZero(isec.normal - Vector3f(0.0f, 1.0f, 0.0f)));