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)
204 writeToStreamRender(out);
205 out << m_xmin << m_ymin << m_zmin;
206 out << m_xmax << m_ymax << m_zmax;
207 out << m_frequency << m_lineWidth;
209 out << m_marks[0] << m_marks[1] << m_marks[2] << m_textScale;
210 for (
int i = 0; i < 3; i++)
211 for (
int j = 0; j < 3; j++) out << m_textRot[i][j];
226 readFromStreamRender(
in);
227 in >> m_xmin >> m_ymin >> m_zmin;
228 in >> m_xmax >> m_ymax >> m_zmax;
229 in >> m_frequency >> m_lineWidth;
232 in >> m_marks[0] >> m_marks[1] >> m_marks[2] >> m_textScale;
233 for (
int i = 0; i < 3; i++)
234 for (
int j = 0; j < 3; j++) in >> m_textRot[i][j];
240 for (
int i = 0; i < 3; i++) m_marks[i] =
v;
263 m_pose.composePoint(bb_min, bb_min);
264 m_pose.composePoint(bb_max, bb_max);
282 for (
int i = 0; i < 3; i++) m_marks[i] =
v;
300 float xmin,
float ymin,
float zmin,
float xmax,
float ymax,
float zmax)
311 int axis,
float yaw_deg,
float pitch_deg,
float roll_deg)
313 ASSERT_(axis >= 0 && axis < 3);
314 m_textRot[axis][0] = yaw_deg;
315 m_textRot[axis][1] = pitch_deg;
316 m_textRot[axis][2] = roll_deg;
319 int axis,
float& yaw_deg,
float& pitch_deg,
float& roll_deg)
const
321 ASSERT_(axis >= 0 && axis < 3);
322 yaw_deg = m_textRot[axis][0];
323 pitch_deg = m_textRot[axis][1];
324 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 setAxisLimits(float xmin, float ymin, float zmin, float xmax, float ymax, float zmax)
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 readFromStream(mrpt::utils::CStream &in, int version) override
Introduces a pure virtual method responsible for loading from a CStream This can not be used directly...
void writeToStream(mrpt::utils::CStream &out, int *getVersion) const override
Introduces a pure virtual method responsible for writing to a CStream.
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)
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
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...
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
void checkOpenGLError()
Checks glGetError and throws an exception if an error situation is found.
mrpt::utils::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 namespace provides a OS-independent interface to many useful functions: filenames manipulation,...
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values,...
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
double x
X,Y,Z coordinates.