class Sphere;
+/*
+ * A plane in 3-space defined by the equation Ax + By + Cz = D, where [A, B, C]
+ * is normal to the plane.
+ */
+
struct Plane
{
Vector3 normal;
d(scalar) {}
+ /* Causes the normal of the plane to become normalized. The scalar may also
+ * be changed to keep the equation true. */
void normalize()
{
Scalar mag = normal.length();
d /= mag;
}
- inline Scalar getDistanceToPoint(const Vector3& point) const
+ /**
+ * Determine the shortest distance between a point and the plane. */
+
+ Scalar getDistanceToPoint(const Vector3& point) const
{
return cml::dot(point, normal) + d;
}
- inline Halfspace intersectsPoint(const Vector3& point) const
+ Halfspace intersects(const Vector3& point) const
{
Scalar distance = getDistanceToPoint(point);
else return POSITIVE;
}
- Halfspace intersectsAabb(const Aabb& aabb) const;
- Halfspace intersectsSphere(const Sphere& sphere) const;
+ Halfspace intersects(const Aabb& aabb) const;
+ Halfspace intersects(const Sphere& sphere) const;
};