Struct Ray
Ray with starting and ending points
struct Ray
;
Example
Ray r = Ray(Vector3f(0, 0, 0), Vector3f(10, 0, 0));
Sphere s = Sphere(Vector3f(3, 0, 0), 1);
Vector3f intersectionPoint;
assert(r .intersectSphere(s, intersectionPoint));
assert(isAlmostZero(intersectionPoint - Vector3f(2, 0, 0)));
Triangle tri;
tri .v[0] = Vector3f(5, -1, 1);
tri .v[1] = Vector3f(5, -1, -1);
tri .v[2] = Vector3f(5, 1, 0);
assert(r .intersectTriangle(tri, intersectionPoint));
assert(isAlmostZero(intersectionPoint - Vector3f(5, 0, 0)));