X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fyoink;a=blobdiff_plain;f=src%2Fmoof%2Fplane.cc;fp=src%2Fmoof%2Fplane.cc;h=dc9ce2d62a4116e8735327ea9fd9130cc4ef10da;hp=4a175b0932cc0ded5f8039bcf3491cc6d215b3c3;hb=574af38ed616d1adfa5e6ce35f67cda1f707f89d;hpb=6c9943707d4f33035830eba0587a61a34eaecbc2 diff --git a/src/moof/plane.cc b/src/moof/plane.cc index 4a175b0..dc9ce2d 100644 --- a/src/moof/plane.cc +++ b/src/moof/plane.cc @@ -1,13 +1,11 @@ -/*] Copyright (c) 2009-2010, Charles McGarvey [************************** +/*] Copyright (c) 2009-2011, 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" @@ -17,33 +15,29 @@ namespace moof { -plane::halfspace plane::intersects(const aabb<3>& aabb) const +plane::halfspace plane::intersects(const aabb3& aabb) const { - vector3 corners[8]; int nPositive = 8; - + vector3 corners[8]; aabb.get_corners(corners); for (int i = 0; i < 8; ++i) { - if (intersects(corners[i]) == negative) - { - --nPositive; - } + if (intersects(corners[i]) == negative) --nPositive; } - if (nPositive == 0) return negative; + if (nPositive == 0) return negative; else if (nPositive == 8) return positive; - else return intersecting; + return intersecting; } -plane::halfspace plane::intersects(const sphere<3>& sphere) const +plane::halfspace plane::intersects(const sphere3& sphere) const { scalar distance = distance_to_point(sphere.point); - if (distance < -sphere.radius) return negative; + if (distance < -sphere.radius) return negative; else if (distance < sphere.radius) return intersecting; - else return positive; + return positive; }