]> Dogcows Code - chaz/yoink/blobdiff - src/moof/sphere.hh
remove some unused stlplus modules
[chaz/yoink] / src / moof / sphere.hh
index cf1bba772316057ca7e625ab0f1b99ed976151f1..75c5808a476cfe5d4e4256f52f76bbd4d691c149 100644 (file)
@@ -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.
 *
-**************************************************************************/
+*****************************************************************************/
 
 #ifndef _MOOF_SPHERE_HH_
 #define _MOOF_SPHERE_HH_
@@ -41,14 +39,12 @@ struct sphere : public cullable, public drawable, public shape<D>
        vector  point;
        scalar  radius;
 
-
        sphere() {}
 
        sphere(const vector& p, scalar r) :
                point(p),
                radius(r) {}
 
-
        void init(const vector& p, scalar r)
        {
                point = p;
@@ -78,7 +74,6 @@ struct sphere : public cullable, public drawable, public shape<D>
                return true;
        }
 
-
        bool intersect(const sphere<D>& sphere, contact<D>& hit) const
        {
                vector n = sphere.point - point;
@@ -110,7 +105,7 @@ struct sphere : public cullable, public drawable, public shape<D>
 
        // a ray inside the sphere will not intersect on its way out
        bool intersect(const ray<D>& ray,
-                                  typename moof::ray<D>::contact& hit) const
+                       typename moof::ray<D>::contact& hit) const
        {
                vector b = point - ray.point;
                scalar z = dot(b, ray.direction);
@@ -134,15 +129,19 @@ struct sphere : public cullable, public drawable, public shape<D>
        }
 };
 
+typedef sphere<2> circle;
+typedef sphere<2> sphere2;
+typedef sphere<3> sphere3;
+
 
 template <>
-inline bool sphere<3>::is_visible(const frustum& frustum) const
+inline bool sphere3::is_visible(const frustum& frustum) const
 {
        return frustum.contains(*this);
 }
 
 template <>
-inline void sphere<2>::draw(scalar alpha) const
+inline void sphere2::draw(scalar alpha) const
 {
        GLUquadricObj* sphereObj = gluNewQuadric();
        gluQuadricDrawStyle(sphereObj, GLU_LINE);
@@ -158,7 +157,7 @@ inline void sphere<2>::draw(scalar alpha) const
 }
 
 template <>
-inline void sphere<3>::draw(scalar alpha) const
+inline void sphere3::draw(scalar alpha) const
 {
        GLUquadricObj* sphereObj = gluNewQuadric();
        gluQuadricDrawStyle(sphereObj, GLU_LINE);
@@ -181,11 +180,6 @@ inline bool checkCollision(const sphere<D>& a, const sphere<D>& b)
 }
 
 
-typedef sphere<2>      sphere2;
-typedef sphere2        circle;
-typedef sphere<3>      sphere3;
-
-
 } // namespace moof
 
 #endif // _MOOF_SPHERE_HH_
This page took 0.019403 seconds and 4 git commands to generate.