26 float xmin,
float ymin,
float zmin,
float xmax,
float ymax,
float zmax,
27 float frecuency,
float lineWidth,
bool marks)
34 m_frequency(frecuency)
41 m_textRot[0][0] = 180.f;
42 m_textRot[0][1] = 0.f;
43 m_textRot[0][2] = 90.f;
45 m_textRot[1][0] = 90.f;
46 m_textRot[1][1] = 0.f;
47 m_textRot[1][2] = 90.f;
49 m_textRot[2][0] = 180.f;
50 m_textRot[2][1] = 0.f;
51 m_textRot[2][2] = 90.f;
71 vbd.emplace_back(m_xmin, 0.0f, 0.0f);
72 vbd.emplace_back(m_xmax, 0.0f, 0.0f);
74 vbd.emplace_back(0.0f, m_ymin, 0.0f);
75 vbd.emplace_back(0.0f, m_ymax, 0.0f);
77 vbd.emplace_back(0.0f, 0.0f, m_zmin);
78 vbd.emplace_back(0.0f, 0.0f, m_zmax);
81 const float ml = m_markLen * m_frequency;
84 const std::array<TPoint3Df, 3> init_trans = {
85 {{m_xmin, .0f, ml}, {.0f, m_ymin, ml}, {.0f, .0f, m_zmin}}};
86 const std::array<std::array<float, 2>, 3> xyz_ranges = {
87 {{m_xmin, m_xmax}, {m_ymin, m_ymax}, {m_zmin, m_zmax}}};
88 const std::array<TPoint3Df, 3> tick0 = {
89 {{0, -ml, -ml}, {-ml, .0f, -ml}, {-ml, .0f, .0f}}};
90 const std::array<TPoint3Df, 3> tick1 = {
91 {{0, ml, -ml}, {ml, .0f, -ml}, {ml, .0f, .0f}}};
92 const std::array<TPoint3Df, 3> endMark = {
93 {{m_xmax + 1.0f * m_frequency, 0, 0},
94 {0, m_ymax + .5f * m_frequency, 0},
95 {0, 0, m_zmax + 0.5f * m_frequency}}};
96 const std::array<const char*, 3> axis2name = {{
"+X",
"+Y",
"+Z"}};
98 for (
unsigned int axis = 0; axis < 3; axis++)
100 if (!m_marks[axis])
continue;
103 tick_incr[axis] = m_frequency;
105 const auto& tf = init_trans[axis];
108 for (
float i = xyz_ranges[axis][0]; i <= xyz_ranges[axis][1];
109 i = i + m_frequency, cur_tf = cur_tf + tick_incr)
112 if (axis != 0 && std::abs(i) < 1e-4f)
continue;
119 label->setScale(m_textScale);
122 cur_tf.x, cur_tf.y, cur_tf.z,
mrpt::DEG2RAD(m_textRot[0][0]),
126 m_gl_labels.emplace_back(label);
129 vbd.emplace_back(cur_tf + tick0[axis]);
130 vbd.emplace_back(cur_tf + tick1[axis]);
135 label->setScale(m_textScale * 1.2f);
137 endMark[axis].x, endMark[axis].y, endMark[axis].z,
140 label->setString(axis2name[axis]);
141 m_gl_labels.emplace_back(label);
144 cbd.assign(vbd.size(), m_color);
146 for (
auto& lb : m_gl_labels) lb->updateBuffers();
168 writeToStreamRender(
out);
169 out << m_xmin << m_ymin << m_zmin;
170 out << m_xmax << m_ymax << m_zmax;
171 out << m_frequency << m_lineWidth;
173 out << m_marks[0] << m_marks[1] << m_marks[2] << m_textScale;
174 for (
auto i : m_textRot)
175 for (
int j = 0; j < 3; j++)
out << i[j];
188 readFromStreamRender(in);
189 in >> m_xmin >> m_ymin >> m_zmin;
190 in >> m_xmax >> m_ymax >> m_zmax;
191 in >> m_frequency >> m_lineWidth;
194 in >> m_marks[0] >> m_marks[1] >> m_marks[2] >> m_textScale;
195 for (
auto& i : m_textRot)
196 for (
int j = 0; j < 3; j++) in >> i[j];
205 if (version >= 2) in >> m_markLen;
257 float xmin,
float ymin,
float zmin,
float xmax,
float ymax,
float zmax)
268 int axis,
float yaw_deg,
float pitch_deg,
float roll_deg)
270 ASSERT_(axis >= 0 && axis < 3);
271 m_textRot[axis][0] = yaw_deg;
272 m_textRot[axis][1] = pitch_deg;
273 m_textRot[axis][2] = roll_deg;
276 int axis,
float& yaw_deg,
float& pitch_deg,
float& roll_deg)
const
278 ASSERT_(axis >= 0 && axis < 3);
279 yaw_deg = m_textRot[axis][0];
280 pitch_deg = m_textRot[axis][1];
281 roll_deg = m_textRot[axis][2];