+++ /dev/null
-
-/*] Copyright (c) 2009-2010, Charles McGarvey [**************************
-**] All rights reserved.
-*
-* vi:ts=4 sw=4 tw=75
-*
-* Distributable under the terms and conditions of the 2-clause BSD license;
-* see the file COPYING for a complete text of the license.
-*
-**************************************************************************/
-
-#include "Aabb.hh"
-#include "Plane.hh"
-#include "Sphere.hh"
-
-
-namespace Mf {
-
-
-Plane::Halfspace Plane::intersects(const Aabb<3>& aabb) const
-{
- Vector3 corners[8];
- int nPositive = 8;
-
- aabb.getCorners(corners);
-
- for (int i = 0; i < 8; ++i)
- {
- if (intersects(corners[i]) == NEGATIVE)
- {
- --nPositive;
- }
- }
-
- if (nPositive == 0) return NEGATIVE;
- else if (nPositive == 8) return POSITIVE;
- else return INTERSECT;
-}
-
-Plane::Halfspace Plane::intersects(const Sphere<3>& sphere) const
-{
- Scalar distance = getDistanceToPoint(sphere.point);
-
- if (distance < -sphere.radius) return NEGATIVE;
- else if (distance < sphere.radius) return INTERSECT;
- else return POSITIVE;
-}
-
-
-} // namespace Mf
-