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];
float getFrequency() const
GLAPI void GLAPIENTRY glEnable(GLenum cap)
#define IMPLEMENTS_SERIALIZABLE(class_name, base, NameSpace)
This must be inserted in all CSerializable classes implementation files.
GLAPI void GLAPIENTRY glPopMatrix(void)
void serializeTo(mrpt::serialization::CArchive &out) const override
Pure virtual method for writing (serializing) to an abstract archive.
EIGEN_STRONG_INLINE void notifyChange() const
Must be called to notify that the object has changed (so, the display list must be updated) ...
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.
#define GL_ONE_MINUS_SRC_ALPHA
GLAPI void GLAPIENTRY glLineWidth(GLfloat width)
static Ptr Create(Args &&... args)
GLubyte GLubyte GLubyte GLubyte w
GLAPI void GLAPIENTRY glBlendFunc(GLenum sfactor, GLenum dfactor)
A renderizable object suitable for rendering with OpenGL's display lists.
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
float getTextScale() const
#define ASSERT_(f)
Defines an assertion mechanism.
void enableTickMarks(bool v=true)
void setLineWidth(float w)
std::shared_ptr< CAxis > Ptr
void render_dl() const override
Render.
double x
X,Y,Z coordinates.
GLAPI void GLAPIENTRY glBegin(GLenum mode)
void getTextLabelOrientation(int axis, float &yaw_deg, float &pitch_deg, float &roll_deg) const
axis: {0,1,2}=>{X,Y,Z}
GLAPI void GLAPIENTRY glVertex3f(GLfloat x, GLfloat y, GLfloat z)
GLAPI void GLAPIENTRY glColor4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha)
GLAPI void GLAPIENTRY glTranslatef(GLfloat x, GLfloat y, GLfloat z)
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
void setTextLabelOrientation(int axis, float yaw_deg, float pitch_deg, float roll_deg)
axis: {0,1,2}=>{X,Y,Z}
float getLineWidth() const
Virtual base class for "archives": classes abstracting I/O streams.
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 checkOpenGLError()
Checks glGetError and throws an exception if an error situation is found.
Draw a 3D world axis, with coordinate marks at some regular interval.
renders glyphs filled with antialiased outlines
void setFrequency(float f)
Changes the frequency of the "ticks".
The namespace for 3D scene representation and rendering.
GLAPI void GLAPIENTRY glEnd(void)
GLAPI void GLAPIENTRY glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z)
GLAPI void GLAPIENTRY glPushMatrix(void)
void setAxisLimits(float xmin, float ymin, float zmin, float xmax, float ymax, float zmax)
renders glyphs as filled polygons
GLAPI void GLAPIENTRY glDisable(GLenum cap)
void setTextScale(float f)
Changes the size of text labels (default:0.25)
void serializeFrom(mrpt::serialization::CArchive &in, uint8_t serial_version) override
Pure virtual method for reading (deserializing) from an abstract archive.
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...
uint8_t serializeGetVersion() const override
Must return the current versioning number of the object.