00001 #pragma once
00002 #ifndef BL7_G2_SPHERE_H
00003 #define BL7_G2_SPHERE_H
00004
00005 #include "../core.h"
00006
00007 #include "./Geometry.h"
00008
00009 #include <MathLabs/Vector2.h>
00010
00011
00012
00013 namespace bl7 {
00014 namespace geometry2 {
00015
00016
00017
00022 class BODYLABS_API Sphere
00023 : public Geometry
00024 {
00025
00026
00027
00028
00029 public:
00031 Sphere(void)
00032 : center( 0 )
00033 , radius( 1 )
00034 { }
00035
00037 virtual ~Sphere(void)
00038 { }
00039
00041 Sphere(const Sphere& rhs)
00042 : center( rhs.center )
00043 , radius( rhs.radius )
00044 { }
00045
00047 Sphere& operator = (const Sphere& rhs)
00048 {
00049 center = rhs.center;
00050 radius = rhs.radius;
00051 return *this;
00052 }
00053
00055 Sphere(const ml7::Vector2& center, const float radius)
00056 : center( center )
00057 , radius( radius )
00058 { }
00059
00061 Sphere(const ml7::Vector2& a, const ml7::Vector2& b, const ml7::Vector2& c)
00062 {
00063 from_points( a, b, c );
00064 }
00065
00067 Sphere& from_points(const ml7::Vector2& a, const ml7::Vector2& b, const ml7::Vector2& c);
00068
00069
00070
00071
00072
00073
00074 public:
00076 ml7::Vector2 center;
00077
00079 float radius;
00080
00081
00082
00083
00084
00085
00086 public:
00090 bool operator == (const Sphere& rhs) const
00091 {
00092 return center == rhs.center && radius == rhs.radius;
00093 }
00094
00098 bool operator != (const Sphere& rhs) const
00099 {
00100 return center != rhs.center || radius != rhs.radius;
00101 }
00102
00103 };
00104
00105
00106
00107 }
00108 }
00109
00110 #endif // BL7_G2_SPHERE_H