MRPT  1.9.9
CAxis.h
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | https://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2019, Individual contributors, see AUTHORS file |
6  | See: https://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See: https://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 #pragma once
10 
12 #include <array>
13 
14 namespace mrpt::opengl
15 {
16 /** Draw a 3D world axis, with coordinate marks at some regular interval
17  * \sa opengl::COpenGLScene
18  *
19  * <div align="center">
20  * <table border="0" cellspan="4" cellspacing="4" style="border-width: 1px;
21  * border-style: solid;">
22  * <tr> <td> mrpt::opengl::CAxis </td> <td> \image html preview_CAxis.png
23  * </td> </tr>
24  * </table>
25  * </div>
26  *
27  * \ingroup mrpt_opengl_grp
28  */
30 {
32  protected:
33  float m_xmin, m_ymin, m_zmin;
34  float m_xmax, m_ymax, m_zmax;
35  float m_frequency;
36  float m_lineWidth;
37  /** draw marks for X,Y,Z */
38  std::array<bool, 3> m_marks = {false, false, false};
39  float m_textScale{0.25f};
40  float m_textRot[3][3]; // {x,y,z},{yaw,pitch,roll}
41  float m_markLen{0.07f};
42 
43  public:
44  void setAxisLimits(
45  float xmin, float ymin, float zmin, float xmax, float ymax, float zmax);
46  /** Changes the frequency of the "ticks" */
47  void setFrequency(float f);
48  float getFrequency() const;
49  void setLineWidth(float w);
50  float getLineWidth() const;
51  /** Changes the size of text labels (default:0.25) */
52  void setTextScale(float f);
53  float getTextScale() const;
54  /** axis: {0,1,2}=>{X,Y,Z} */
56  int axis, float yaw_deg, float pitch_deg, float roll_deg);
57  /** axis: {0,1,2}=>{X,Y,Z} */
59  int axis, float& yaw_deg, float& pitch_deg, float& roll_deg) const;
60 
61  void enableTickMarks(bool v = true);
62  void enableTickMarks(bool show_x, bool show_y, bool show_z);
63  /** As a ratio of "marks frequency" (default: 0.05) */
64  void setTickMarksLength(float len);
65  float getTickMarksLength(float len) { return m_markLen; }
66 
67  /** Render */
68  void render_dl() const override;
69 
70  /** Evaluates the bounding box of this object (including possible children)
71  * in the coordinate frame of the object parent. */
72  void getBoundingBox(
74  mrpt::math::TPoint3D& bb_max) const override;
75 
76  /** Constructor */
77  CAxis(
78  float xmin = -1.0f, float ymin = -1.0f, float zmin = -1.0f,
79  float xmax = 1.0f, float ymax = 1.0f, float zmax = 1.0f,
80  float frecuency = 1.f, float lineWidth = 3.0f, bool marks = false);
81 
82  /** Private, virtual destructor: only can be deleted from smart pointers */
83  ~CAxis() override = default;
84 };
85 
86 } // namespace mrpt::opengl
float getFrequency() const
Definition: CAxis.cpp:235
float m_lineWidth
Definition: CAxis.h:36
GLenum GLsizei len
Definition: glext.h:4756
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:4199
A renderizable object suitable for rendering with OpenGL&#39;s display lists.
CAxis(float xmin=-1.0f, float ymin=-1.0f, float zmin=-1.0f, float xmax=1.0f, float ymax=1.0f, float zmax=1.0f, float frecuency=1.f, float lineWidth=3.0f, bool marks=false)
Constructor.
Definition: CAxis.cpp:27
float getTextScale() const
Definition: CAxis.cpp:260
float m_textRot[3][3]
Definition: CAxis.h:40
void enableTickMarks(bool v=true)
Definition: CAxis.cpp:242
~CAxis() override=default
Private, virtual destructor: only can be deleted from smart pointers.
void setLineWidth(float w)
Definition: CAxis.cpp:236
void render_dl() const override
Render.
Definition: CAxis.cpp:62
void getTextLabelOrientation(int axis, float &yaw_deg, float &pitch_deg, float &roll_deg) const
axis: {0,1,2}=>{X,Y,Z}
Definition: CAxis.cpp:280
float m_textScale
Definition: CAxis.h:39
float getTickMarksLength(float len)
Definition: CAxis.h:65
std::array< bool, 3 > m_marks
draw marks for X,Y,Z
Definition: CAxis.h:38
GLclampd zmax
Definition: glext.h:8064
const GLdouble * v
Definition: glext.h:3684
void setTextLabelOrientation(int axis, float yaw_deg, float pitch_deg, float roll_deg)
axis: {0,1,2}=>{X,Y,Z}
Definition: CAxis.cpp:272
float m_markLen
Definition: CAxis.h:41
float getLineWidth() const
Definition: CAxis.cpp:241
void setTickMarksLength(float len)
As a ratio of "marks frequency" (default: 0.05)
Definition: CAxis.cpp:56
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...
Definition: CAxis.cpp:213
float m_frequency
Definition: CAxis.h:35
Draw a 3D world axis, with coordinate marks at some regular interval.
Definition: CAxis.h:29
void setFrequency(float f)
Changes the frequency of the "ticks".
Definition: CAxis.cpp:229
The namespace for 3D scene representation and rendering.
Definition: CGlCanvasBase.h:15
const auto bb_max
#define DEFINE_SERIALIZABLE(class_name, NS)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
const auto bb_min
Lightweight 3D point.
Definition: TPoint3D.h:90
void setAxisLimits(float xmin, float ymin, float zmin, float xmax, float ymax, float zmax)
Definition: CAxis.cpp:261
void setTextScale(float f)
Changes the size of text labels (default:0.25)
Definition: CAxis.cpp:254



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: 45d659fbb Tue Dec 10 18:21:14 2019 +0100 at mar dic 10 18:30:09 CET 2019