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