29 float x0,
float y0,
float z0,
float x1,
float y1,
float z1,
float headRatio,
30 float smallRadius,
float largeRadius,
float arrow_roll,
float arrow_pitch,
35 x0, y0, z0, x1, y1, z1, headRatio, smallRadius, largeRadius,
36 arrow_roll, arrow_pitch, arrow_yaw));
43 #if MRPT_HAS_OPENGL_GLUT 45 GLUquadricObj* obj1 = gluNewQuadric();
46 GLUquadricObj* obj2 = gluNewQuadric();
51 float vx = m_x1 - m_x0;
52 float vy = m_y1 - m_y0;
53 float vz = m_z1 - m_z0;
54 if ((m_arrow_roll != -1.0f) || (m_arrow_pitch != -1.0f) ||
55 (m_arrow_yaw != -1.0f))
64 float cr = cos(m_arrow_roll);
65 float sr = sin(m_arrow_roll);
66 float cp = cos(m_arrow_pitch);
67 float sp = sin(m_arrow_pitch);
68 float cy = cos(m_arrow_yaw);
69 float sy = sin(m_arrow_yaw);
73 m(0, 1) = cr * sp * sy - sr * cy;
74 m(0, 2) = sr * sy + cr * sp * cy;
76 m(1, 1) = sr * sp * sy + cr * cy;
77 m(1, 2) = sr * sp * cy - cr * sy;
108 mat[3] = mat[7] = mat[11] = 0;
120 if (vx != 0 || vy != 0)
148 glScalef(1.0f, 1.0f, v_mod * (1.0f - m_headRatio));
149 gluCylinder(obj1, m_smallRadius, m_smallRadius, 1, 10, 1);
155 mat[12] = m_x0 + vx * v_mod * (1.0f - m_headRatio);
156 mat[13] = m_y0 + vy * v_mod * (1.0f - m_headRatio);
157 mat[14] = m_z0 + vz * v_mod * (1.0f - m_headRatio);
163 glScalef(1.0f, 1.0f, v_mod * m_headRatio);
165 gluCylinder(obj2, m_largeRadius, 0, 1, 10, 10);
169 gluDeleteQuadric(obj1);
170 gluDeleteQuadric(obj2);
178 writeToStreamRender(out);
179 out << m_x0 << m_y0 << m_z0;
180 out << m_x1 << m_y1 << m_z1;
181 out << m_headRatio << m_smallRadius << m_largeRadius;
182 out << m_arrow_roll << m_arrow_pitch << m_arrow_yaw;
191 readFromStreamRender(
in);
192 in >> m_x0 >> m_y0 >> m_z0;
193 in >> m_x1 >> m_y1 >> m_z1;
194 in >> m_headRatio >> m_smallRadius >> m_largeRadius;
199 readFromStreamRender(
in);
200 in >> m_x0 >> m_y0 >> m_z0;
201 in >> m_x1 >> m_y1 >> m_z1;
202 in >> m_headRatio >> m_smallRadius >> m_largeRadius;
203 in >> m_arrow_roll >> m_arrow_pitch >> m_arrow_yaw;
219 bb_max.
x = std::max(m_x0, m_x1);
220 bb_max.
y = std::max(m_y0, m_y1);
221 bb_max.
z = std::max(m_z0, m_z1);
224 m_pose.composePoint(bb_min, bb_min);
225 m_pose.composePoint(bb_max, bb_max);
void render_dl() const override
Render.
GLAPI void GLAPIENTRY glMultMatrixf(const GLfloat *m)
void getBoundingBox(mrpt::math::TPoint3D &bb_min, mrpt::math::TPoint3D &bb_max) const override
Evaluates the bounding box of this object (including possible children) in the coordinate frame of th...
#define IMPLEMENTS_SERIALIZABLE(class_name, base, NameSpace)
This must be inserted in all CSerializable classes implementation files.
GLAPI void GLAPIENTRY glPopMatrix(void)
EIGEN_STRONG_INLINE void notifyChange() const
Must be called to notify that the object has changed (so, the display list must be updated) ...
uint8_t serializeGetVersion() const override
Must return the current versioning number of the object.
void crossProduct3D(const T &v0, const U &v1, V &vOut)
Computes the cross product of two 3D vectors, returning a vector normal to both.
A renderizable object suitable for rendering with OpenGL's display lists.
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
T square(const T x)
Inline function for the square of a number.
This base provides a set of functions for maths stuff.
double x
X,Y,Z coordinates.
void serializeTo(mrpt::serialization::CArchive &out) const override
Pure virtual method for writing (serializing) to an abstract archive.
void serializeFrom(mrpt::serialization::CArchive &in, uint8_t serial_version) override
Pure virtual method for reading (deserializing) from an abstract archive.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
Virtual base class for "archives": classes abstracting I/O streams.
GLAPI void GLAPIENTRY glScalef(GLfloat x, GLfloat y, GLfloat z)
The namespace for 3D scene representation and rendering.
A matrix of dynamic size.
GLAPI void GLAPIENTRY glPushMatrix(void)
std::shared_ptr< CArrow > Ptr