Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef opengl_CSphere_H
00029 #define opengl_CSphere_H
00030
00031 #include <mrpt/opengl/CRenderizable.h>
00032
00033 namespace mrpt
00034 {
00035 namespace opengl
00036 {
00037 class MRPTDLLIMPEXP CSphere;
00038
00039
00040 DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE( CSphere, CRenderizable )
00041
00042
00043
00044
00045 class MRPTDLLIMPEXP CSphere : public CRenderizable
00046 {
00047 DEFINE_SERIALIZABLE( CSphere )
00048
00049 protected:
00050 float m_radius;
00051 int m_nDivsLongitude,m_nDivsLatitude;
00052 bool m_keepRadiusIndependentEyeDistance;
00053
00054 public:
00055 void setRadius(float r) { m_radius=r; }
00056 float getRadius() const {return m_radius; }
00057
00058 void setNumberDivsLongitude(int N) { m_nDivsLongitude=N; }
00059 void setNumberDivsLatitude(int N) { m_nDivsLatitude=N; }
00060 void enableRadiusIndependentOfEyeDistance(bool v=true) { m_keepRadiusIndependentEyeDistance=v; }
00061
00062
00063
00064 static CSpherePtr Create(
00065 float radius,
00066 int nDivsLongitude = 20,
00067 int nDivsLatitude = 20 )
00068 {
00069 return CSpherePtr( new CSphere(radius,nDivsLongitude,nDivsLatitude) );
00070 }
00071
00072
00073 void render() const;
00074
00075
00076 virtual bool traceRay(const mrpt::poses::CPose3D &o,double &dist) const;
00077
00078 private:
00079
00080
00081 CSphere(
00082 float radius = 1.0f,
00083 int nDivsLongitude = 20,
00084 int nDivsLatitude = 20
00085 ) :
00086 m_radius(radius),
00087 m_nDivsLongitude(nDivsLongitude),
00088 m_nDivsLatitude(nDivsLatitude),
00089 m_keepRadiusIndependentEyeDistance(false)
00090 {
00091 }
00092
00093
00094 virtual ~CSphere() { }
00095 };
00096
00097 }
00098
00099 }
00100
00101 #endif