28 float xmin,
float ymin,
float zmin,
float xmax,
float ymax,
float zmax,
29 float frecuency,
float lineWidth,
bool marks)
36 m_frequency(frecuency),
37 m_lineWidth(lineWidth),
40 for (
int i = 0; i < 3; i++) m_marks[i] = marks;
43 m_textRot[0][0] = 180.f;
44 m_textRot[0][1] = 0.f;
45 m_textRot[0][2] = 90.f;
47 m_textRot[1][0] = 90.f;
48 m_textRot[1][1] = 0.f;
49 m_textRot[1][2] = 90.f;
51 m_textRot[2][0] = 180.f;
52 m_textRot[2][1] = 0.f;
53 m_textRot[2][2] = 90.f;
57 float xmin,
float ymin,
float zmin,
float xmax,
float ymax,
float zmax,
58 float frecuency,
float lineWidth,
bool marks)
62 xmin, ymin, zmin, xmax, ymax,
zmax, frecuency, lineWidth, marks));
67 #if MRPT_HAS_OPENGL_GLUT
81 glColor4ub(m_color.R, m_color.G, m_color.B, m_color.A);
108 for (
float i = m_xmin; i <= m_xmax; i = i + m_frequency)
134 for (
float i = m_ymin; i <= m_ymax; i = i + m_frequency)
136 if (std::abs(i) > 1e-4)
163 for (
float i = m_zmin; i <= m_zmax; i = i + m_frequency)
165 if (std::abs(i) > 1e-4)
197 writeToStreamRender(out);
198 out << m_xmin << m_ymin << m_zmin;
199 out << m_xmax << m_ymax << m_zmax;
200 out << m_frequency << m_lineWidth;
202 out << m_marks[0] << m_marks[1] << m_marks[2] << m_textScale;
203 for (
int i = 0; i < 3; i++)
204 for (
int j = 0; j < 3; j++) out << m_textRot[i][j];
214 readFromStreamRender(
in);
215 in >> m_xmin >> m_ymin >> m_zmin;
216 in >> m_xmax >> m_ymax >> m_zmax;
217 in >> m_frequency >> m_lineWidth;
220 in >> m_marks[0] >> m_marks[1] >> m_marks[2] >> m_textScale;
221 for (
int i = 0; i < 3; i++)
222 for (
int j = 0; j < 3; j++) in >> m_textRot[i][j];
228 for (
int i = 0; i < 3; i++) m_marks[i] =
v;
251 m_pose.composePoint(bb_min, bb_min);
252 m_pose.composePoint(bb_max, bb_max);
270 for (
int i = 0; i < 3; i++) m_marks[i] =
v;
288 float xmin,
float ymin,
float zmin,
float xmax,
float ymax,
float zmax)
299 int axis,
float yaw_deg,
float pitch_deg,
float roll_deg)
301 ASSERT_(axis >= 0 && axis < 3);
302 m_textRot[axis][0] = yaw_deg;
303 m_textRot[axis][1] = pitch_deg;
304 m_textRot[axis][2] = roll_deg;
307 int axis,
float& yaw_deg,
float& pitch_deg,
float& roll_deg)
const
309 ASSERT_(axis >= 0 && axis < 3);
310 yaw_deg = m_textRot[axis][0];
311 pitch_deg = m_textRot[axis][1];
312 roll_deg = m_textRot[axis][2];
#define IMPLEMENTS_SERIALIZABLE(class_name, base, NameSpace)
This must be inserted in all CSerializable classes implementation files.
Draw a 3D world axis, with coordinate marks at some regular interval.
float getLineWidth() const
void serializeFrom(mrpt::serialization::CArchive &in, uint8_t serial_version) override
Pure virtual method for reading (deserializing) from an abstract archive.
void serializeTo(mrpt::serialization::CArchive &out) const override
Pure virtual method for writing (serializing) to an abstract archive.
void setAxisLimits(float xmin, float ymin, float zmin, float xmax, float ymax, float zmax)
uint8_t serializeGetVersion() const override
Must return the current versioning number of the object.
float getTextScale() const
float getFrequency() const
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...
void setTextLabelOrientation(int axis, float yaw_deg, float pitch_deg, float roll_deg)
axis: {0,1,2}=>{X,Y,Z}
static Ptr Create(Args &&... args)
void setFrequency(float f)
Changes the frequency of the "ticks".
std::shared_ptr< CAxis > Ptr
void setLineWidth(float w)
void setTextScale(float f)
Changes the size of text labels (default:0.25)
void enableTickMarks(bool v=true)
void getTextLabelOrientation(int axis, float &yaw_deg, float &pitch_deg, float &roll_deg) const
axis: {0,1,2}=>{X,Y,Z}
void render_dl() const override
Render.
A renderizable object suitable for rendering with OpenGL's display lists.
EIGEN_STRONG_INLINE void notifyChange() const
Must be called to notify that the object has changed (so, the display list must be updated)
Virtual base class for "archives": classes abstracting I/O streams.
#define ASSERT_(f)
Defines an assertion mechanism.
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
GLAPI void GLAPIENTRY glTranslatef(GLfloat x, GLfloat y, GLfloat z)
GLAPI void GLAPIENTRY glEnable(GLenum cap)
GLAPI void GLAPIENTRY glPushMatrix(void)
GLAPI void GLAPIENTRY glLineWidth(GLfloat width)
GLAPI void GLAPIENTRY glBlendFunc(GLenum sfactor, GLenum dfactor)
GLAPI void GLAPIENTRY glBegin(GLenum mode)
GLAPI void GLAPIENTRY glVertex3f(GLfloat x, GLfloat y, GLfloat z)
GLAPI void GLAPIENTRY glPopMatrix(void)
#define GL_ONE_MINUS_SRC_ALPHA
GLAPI void GLAPIENTRY glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z)
GLAPI void GLAPIENTRY glEnd(void)
GLAPI void GLAPIENTRY glDisable(GLenum cap)
GLAPI void GLAPIENTRY glColor4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha)
GLubyte GLubyte GLubyte GLubyte w
int sprintf(char *buf, size_t bufSize, const char *format,...) noexcept MRPT_printf_format_check(3
An OS-independent version of sprintf (Notice the bufSize param, which may be ignored in some compiler...
void checkOpenGLError()
Checks glGetError and throws an exception if an error situation is found.
mrpt::img::TPixelCoordf glDrawText(const std::string &text, const double textScale, enum TOpenGLFontStyle style=NICE, double spacing=1.5, double kerning=0.1)
renders a string in GL using the current settings.
The namespace for 3D scene representation and rendering.
@ NICE
renders glyphs filled with antialiased outlines
@ FILL
renders glyphs as filled polygons
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
double x
X,Y,Z coordinates.