sphere.h

Go to the documentation of this file.
00001 // -*- Mode: C++; tab-width: 2; -*-
00002 // vi: set ts=2:
00003 //
00004 // $Id: sphere.h,v 1.9.16.1 2007-03-25 21:26:11 oliver Exp $
00005 //
00006 
00007 #ifndef BALL_VIEW_PRIMITIV_SPHERE_H
00008 #define BALL_VIEW_PRIMITIV_SPHERE_H
00009 
00010 #ifndef BALL_VIEW_KERNEL_GEOMETRICOBJECT_H
00011 # include <BALL/VIEW/KERNEL/geometricObject.h>
00012 #endif
00013 
00014 #ifndef BALL_VIEW_MATHS_SPHERE3_H
00015 # include <BALL/MATHS/sphere3.h>
00016 #endif
00017 
00018 namespace BALL
00019 {
00020   namespace VIEW
00021   {
00022 
00030     class BALL_VIEW_EXPORT Sphere
00031       : public GeometricObject,
00032         protected Sphere3
00033     {
00034       public:
00035 
00036       BALL_CREATE(Sphere)
00037 
00038       
00041 
00044       Sphere();
00045 
00049       Sphere(const Sphere& sphere);
00050 
00052 
00054 
00057       virtual ~Sphere();
00058 
00063       virtual void clear();
00064 
00066 
00069 
00072       void set(const Sphere& sphere);
00073 
00076       const Sphere& operator = (const Sphere& sphere);
00077 
00080       void swap(Sphere& sphere);
00081 
00083       void setRadius(float new_radius)
00084         { radius = new_radius;}
00085 
00087       float getRadius() const
00088         { return radius;}
00089 
00091       void setPosition(const Vector3& v3)
00092         { point_ptr_->set(v3);}
00093 
00095       const Vector3& getPosition() const
00096         { return *point_ptr_;}
00097 
00099       void setPositionAddress(const Vector3& v3)
00100         { point_ptr_ = (Vector3 *)&v3;}
00101 
00103       Vector3* getPositionAddress()
00104         { return point_ptr_;}
00105 
00107       bool isDefaultPositionAddress()
00108         { return point_ptr_ == &p;}
00109 
00111       void setDefaultPositionAddress()
00112         { point_ptr_ = & p;}
00113 
00115 
00118 
00128       virtual bool isValid() const;
00129 
00140       virtual void dump(std::ostream&  s = std::cout, Size depth = 0) const;
00141       
00142       // Method to get all vertices from a geometric object
00143       virtual void getVertices(vector<Vector3>& vertices) const;
00144 
00146       
00147       protected:
00148       
00149       Vector3* point_ptr_;
00150     };
00151 
00152 } } // namespaces
00153 
00154 #endif // BALL_VIEW_PRIMITIV_SPHERE_H