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_CArrow_H
00029 #define opengl_CArrow_H
00030
00031 #include <mrpt/opengl/CRenderizableDisplayList.h>
00032
00033 namespace mrpt
00034 {
00035 namespace opengl
00036 {
00037 class OPENGL_IMPEXP CArrow;
00038
00039
00040 DEFINE_SERIALIZABLE_PRE_CUSTOM_BASE_LINKAGE( CArrow, CRenderizableDisplayList, OPENGL_IMPEXP )
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053 class OPENGL_IMPEXP CArrow : public CRenderizableDisplayList
00054 {
00055 DEFINE_SERIALIZABLE( CArrow )
00056 protected:
00057 mutable float m_x0,m_y0,m_z0;
00058 mutable float m_x1,m_y1,m_z1;
00059 float m_headRatio;
00060 float m_smallRadius, m_largeRadius;
00061
00062 float m_arrow_roll;
00063 float m_arrow_pitch;
00064 float m_arrow_yaw;
00065
00066 public:
00067
00068 void setArrowEnds(float x0,float y0, float z0, float x1,float y1, float z1)
00069 {
00070 m_x0=x0; m_y0 = y0; m_z0=z0;
00071 m_x1=x1; m_y1 = y1; m_z1=z1;
00072 CRenderizableDisplayList::notifyChange();
00073 }
00074 void setHeadRatio(float rat) { m_headRatio=rat; CRenderizableDisplayList::notifyChange(); }
00075 void setSmallRadius(float rat) { m_smallRadius=rat; CRenderizableDisplayList::notifyChange(); }
00076 void setLargeRadius(float rat) { m_largeRadius=rat; CRenderizableDisplayList::notifyChange(); }
00077 void setArrowYawPitchRoll(float yaw,float pitch, float roll ) { m_arrow_yaw=yaw; m_arrow_pitch=pitch; m_arrow_roll=roll; CRenderizableDisplayList::notifyChange(); }
00078
00079
00080
00081 void render_dl() const;
00082
00083
00084 static CArrowPtr Create(
00085 float x0,
00086 float y0,
00087 float z0,
00088 float x1,
00089 float y1,
00090 float z1,
00091 float headRatio = 0.2f,
00092 float smallRadius = 0.05f,
00093 float largeRadius = 0.2f,
00094 float arrow_roll = -1.0f,
00095 float arrow_pitch = -1.0f,
00096 float arrow_yaw = -1.0f
00097 )
00098 {
00099 return CArrowPtr(new CArrow(x0,y0,z0, x1,y1,z1, headRatio, smallRadius, largeRadius, arrow_roll, arrow_pitch, arrow_yaw ));
00100 }
00101
00102 private:
00103
00104
00105 CArrow(
00106 float x0 = 0,
00107 float y0 = 0,
00108 float z0 = 0,
00109 float x1 = 1,
00110 float y1 = 1,
00111 float z1 = 1,
00112 float headRatio = 0.2f,
00113 float smallRadius = 0.05f,
00114 float largeRadius = 0.2f,
00115 float arrow_roll = -1.0f,
00116 float arrow_pitch = -1.0f,
00117 float arrow_yaw = -1.0f
00118 ) :
00119 m_x0(x0),m_y0(y0),m_z0(z0),
00120 m_x1(x1),m_y1(y1),m_z1(z1),
00121 m_headRatio(headRatio),
00122 m_smallRadius(smallRadius),
00123 m_largeRadius(largeRadius),
00124 m_arrow_roll(arrow_roll),
00125 m_arrow_pitch(arrow_pitch),
00126 m_arrow_yaw(arrow_yaw)
00127 {
00128 }
00129
00130
00131 virtual ~CArrow() { }
00132 };
00133
00134
00135 }
00136 }
00137
00138 #endif