32 #if MRPT_HAS_OPENGL_GLUT 34 GLUquadricObj* obj1 = gluNewQuadric();
35 GLUquadricObj* obj2 = gluNewQuadric();
40 float vx = m_x1 - m_x0;
41 float vy = m_y1 - m_y0;
42 float vz = m_z1 - m_z0;
43 if ((m_arrow_roll != -1.0f) || (m_arrow_pitch != -1.0f) ||
44 (m_arrow_yaw != -1.0f))
53 float cr = cos(m_arrow_roll);
54 float sr = sin(m_arrow_roll);
55 float cp = cos(m_arrow_pitch);
56 float sp = sin(m_arrow_pitch);
57 float cy = cos(m_arrow_yaw);
58 float sy = sin(m_arrow_yaw);
62 m(0, 1) = cr * sp * sy - sr * cy;
63 m(0, 2) = sr * sy + cr * sp * cy;
65 m(1, 1) = sr * sp * sy + cr * cy;
66 m(1, 2) = sr * sp * cy - cr * sy;
97 mat[3] = mat[7] = mat[11] = 0;
109 if (vx != 0 || vy != 0)
137 glScalef(1.0f, 1.0f, v_mod * (1.0f - m_headRatio));
138 gluCylinder(obj1, m_smallRadius, m_smallRadius, 1, 10, 1);
144 mat[12] = m_x0 + vx * v_mod * (1.0f - m_headRatio);
145 mat[13] = m_y0 + vy * v_mod * (1.0f - m_headRatio);
146 mat[14] = m_z0 + vz * v_mod * (1.0f - m_headRatio);
152 glScalef(1.0f, 1.0f, v_mod * m_headRatio);
154 gluCylinder(obj2, m_largeRadius, 0, 1, 10, 10);
158 gluDeleteQuadric(obj1);
159 gluDeleteQuadric(obj2);
167 writeToStreamRender(out);
168 out << m_x0 << m_y0 << m_z0;
169 out << m_x1 << m_y1 << m_z1;
170 out << m_headRatio << m_smallRadius << m_largeRadius;
171 out << m_arrow_roll << m_arrow_pitch << m_arrow_yaw;
180 readFromStreamRender(
in);
181 in >> m_x0 >> m_y0 >> m_z0;
182 in >> m_x1 >> m_y1 >> m_z1;
183 in >> m_headRatio >> m_smallRadius >> m_largeRadius;
188 readFromStreamRender(
in);
189 in >> m_x0 >> m_y0 >> m_z0;
190 in >> m_x1 >> m_y1 >> m_z1;
191 in >> m_headRatio >> m_smallRadius >> m_largeRadius;
192 in >> m_arrow_roll >> m_arrow_pitch >> m_arrow_yaw;
210 out[
"headRatio"] = m_headRatio;
211 out[
"smallRadius"] = m_smallRadius;
212 out[
"largeRadius"] = m_largeRadius;
223 m_x0 =
static_cast<float>(
in[
"x0"]);
224 m_y0 =
static_cast<float>(
in[
"y0"]);
225 m_z0 =
static_cast<float>(
in[
"z0"]);
226 m_x1 =
static_cast<float>(
in[
"x1"]);
227 m_y1 =
static_cast<float>(
in[
"y1"]);
228 m_z1 =
static_cast<float>(
in[
"z1"]);
229 m_headRatio =
static_cast<float>(
in[
"headRatio"]);
230 m_smallRadius =
static_cast<float>(
in[
"smallRadius"]);
231 m_largeRadius =
static_cast<float>(
in[
"largeRadius"]);
245 bb_max.x = std::max(m_x0, m_x1);
246 bb_max.y = std::max(m_y0, m_y1);
247 bb_max.z = std::max(m_z0, m_z1);
void notifyChange() const
Must be called to notify that the object has changed (so, the display list must be updated) ...
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)
To be added to all CSerializable-classes implementation files.
GLAPI void GLAPIENTRY glPopMatrix(void)
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.
Virtual base class for "schematic archives" (JSON, XML,...)
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.
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.
#define SCHEMA_DESERIALIZE_DATATYPE_VERSION()
For use inside serializeFrom(CSchemeArchiveBase) methods.
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.
typedef void(APIENTRYP PFNGLBLENDCOLORPROC)(GLclampf red
#define SCHEMA_SERIALIZE_DATATYPE_VERSION(ser_version)
For use inside all serializeTo(CSchemeArchiveBase) methods.
GLAPI void GLAPIENTRY glPushMatrix(void)
This template class provides the basic functionality for a general 2D any-size, resizable container o...