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