27 #define _USE_MATH_DEFINES 30 #include <unordered_map> 38 #ifndef GL_CLAMP_TO_BORDER 39 #define GL_CLAMP_TO_BORDER 0x812D 41 #ifndef GL_CLAMP_TO_EDGE 42 #define GL_CLAMP_TO_EDGE 0x812F 60 std::lock_guard<std::mutex>
lock(other.
_mtx);
68 std::lock_guard<std::mutex>
lock(
_mtx);
85 std::lock_guard<std::mutex>
lock(
_mtx);
105 return std::max(
std::min(max, x), min);
112 x =
clamp((x - min) , 0.0, 1.0);
116 x =
clamp((x - min) / (max - min), 0.0, 1.0);
119 return x*x*(3 - 2 *
x);
124 return b * t + a * (1 -
t);
140 float length()
const {
return sqrt(x*x + y*y + z*z); }
155 return { a.
y * b.
z - b.
y * a.
z, a.
x * b.
z - b.
x * a.
z, a.
x * b.
y - a.
y * b.
x };
160 return plane.
a * point.
x + plane.
b * point.
y + plane.
c * point.
z + plane.
d;
165 return { a.
x *
t, a.
y *
t, a.
z * t };
170 return { a.
x /
t, a.
y /
t, a.
z / t };
175 return { a.
x + b.
x, a.
y + b.
y, a.
z + b.
z };
180 return { a.
x - b.
x, a.
y - b.
y, a.
z - b.
z };
185 return b * t + a * (1 -
t);
192 float length()
const {
return sqrt(x*x + y*y); }
202 return a.
x * b.
x + a.
y * b.
y;
212 auto v1 =
lerp(rect[0], rect[1], p.
x);
213 auto v2 =
lerp(rect[3], rect[2], p.
x);
221 std::vector<plane_3d>
res;
222 res.reserve(parts*parts);
223 for (
float i = 0.
f;
i < parts;
i++)
225 for (
float j = 0.
f;
j < parts;
j++)
228 r[0] =
lerp(rect, {
i / parts,
j / parts });
229 r[1] =
lerp(rect, {
i / parts, (
j + 1) / parts });
230 r[2] =
lerp(rect, { (
i + 1) / parts, (
j + 1) / parts });
231 r[3] =
lerp(rect, { (
i + 1) / parts,
j / parts });
240 return a.
x*b.
x + a.
y*b.
y + a.
z*b.
z;
245 std::vector<float> angles;
247 for (
size_t i = 0;
i < p.size();
i++)
250 auto p2 = p[(
i+1) % p.size()];
256 angles.push_back(acos((
p1 *
p2) / sqrt(
p1.length() * p2.length())));
258 return std::all_of(angles.begin(), angles.end(), [](
float f) {
return f > 0; }) ||
259 std::all_of(angles.begin(), angles.end(), [](
float f) {
return f < 0; });
264 return { a.
x - b.
x, a.
y - b.
y };
269 return { a * b.
x, a * b.
y };
276 operator float*()
const 284 for (
int i = 0;
i < 4;
i++)
291 std::memset(mat, 0,
sizeof(mat));
296 std::memcpy(mat,vals,
sizeof(mat));
310 for (
int i = 0;
i < 4;
i++)
312 for (
int j = 0;
j < 4;
j++)
314 mat[
i][
j] = vals[
i * 4 +
j];
325 mat[0][0] = 1 - 2*q.
y*q.
y - 2*q.
z*q.
z; mat[0][1] = 2*q.
x*q.
y - 2*q.
z*q.
w; mat[0][2] = 2*q.
x*q.
z + 2*q.
y*q.
w; mat[0][3] = 0.0f;
326 mat[1][0] = 2*q.
x*q.
y + 2*q.
z*q.
w; mat[1][1] = 1 - 2*q.
x*q.
x - 2*q.
z*q.
z; mat[1][2] = 2*q.
y*q.
z - 2*q.
x*q.
w; mat[1][3] = 0.0f;
327 mat[2][0] = 2*q.
x*q.
z - 2*q.
y*q.
w; mat[2][1] = 2*q.
y*q.
z + 2*q.
x*q.
w; mat[2][2] = 1 - 2*q.
x*q.
x - 2*q.
y*q.
y; mat[2][3] = 0.0f;
328 mat[3][0] = 0.0f; mat[3][1] = 0.0f; mat[3][2] = 0.0f; mat[3][3] = 1.0f;
334 mat[0][0] = 1.0f; mat[0][1] = 0.0f; mat[0][2] = 0.0f; mat[0][3] = t.
x;
335 mat[1][0] = 0.0f; mat[1][1] = 1.0f; mat[1][2] = 0.0f; mat[1][3] = t.
y;
336 mat[2][0] = 0.0f; mat[2][1] = 0.0f; mat[2][2] = 1.0f; mat[2][3] = t.
z;
337 mat[3][0] = 0.0f; mat[3][1] = 0.0f; mat[3][2] = 0.0f; mat[3][3] = 1.0f;
342 float norm = sqrtf(a.
x*a.
x + a.
y*a.
y + a.
z*a.
z + a.
w*a.
w);
355 tr[0] = (mat[0][0] + mat[1][1] + mat[2][2]);
356 tr[1] = (mat[0][0] - mat[1][1] - mat[2][2]);
357 tr[2] = (-mat[0][0] + mat[1][1] - mat[2][2]);
358 tr[3] = (-mat[0][0] - mat[1][1] + mat[2][2]);
359 if (tr[0] >= tr[1] && tr[0] >= tr[2] && tr[0] >= tr[3])
361 float s = 2 * sqrt(tr[0] + 1);
363 res.
x = (mat[2][1] - mat[1][2]) / s;
364 res.
y = (mat[0][2] - mat[2][0]) / s;
365 res.
z = (mat[1][0] - mat[0][1]) / s;
367 else if (tr[1] >= tr[2] && tr[1] >= tr[3]) {
368 float s = 2 * sqrt(tr[1] + 1);
369 res.
w = (mat[2][1] - mat[1][2]) / s;
371 res.
y = (mat[1][0] + mat[0][1]) / s;
372 res.
z = (mat[2][0] + mat[0][2]) / s;
374 else if (tr[2] >= tr[3]) {
375 float s = 2 * sqrt(tr[2] + 1);
376 res.
w = (mat[0][2] - mat[2][0]) / s;
377 res.
x = (mat[1][0] + mat[0][1]) / s;
379 res.
z = (mat[1][2] + mat[2][1]) / s;
382 float s = 2 * sqrt(tr[3] + 1);
383 res.
w = (mat[1][0] - mat[0][1]) / s;
384 res.
x = (mat[0][2] + mat[2][0]) / s;
385 res.
y = (mat[1][2] + mat[2][1]) / s;
393 column_major[0] = mat[0][0];
394 column_major[1] = mat[1][0];
395 column_major[2] = mat[2][0];
396 column_major[3] = mat[3][0];
397 column_major[4] = mat[0][1];
398 column_major[5] = mat[1][1];
399 column_major[6] = mat[2][1];
400 column_major[7] = mat[3][1];
401 column_major[8] = mat[0][2];
402 column_major[9] = mat[1][2];
403 column_major[10] = mat[2][2];
404 column_major[11] = mat[3][2];
405 column_major[12] = mat[0][3];
406 column_major[13] = mat[1][3];
407 column_major[14] = mat[2][3];
408 column_major[15] = mat[3][3];
415 for (
int i = 0;
i < 4;
i++)
417 for (
int j = 0;
j < 4;
j++)
420 for (
int k = 0; k < 4; k++)
434 res.
x =
a(i, 0) * b.
x +
a(i, 1) * b.
y +
a(i, 2) * b.
z +
a(i, 3) * b.
w; i++;
435 res.
y =
a(i, 0) * b.
x +
a(i, 1) * b.
y +
a(i, 2) * b.
z +
a(i, 3) * b.
w; i++;
436 res.
z =
a(i, 0) * b.
x +
a(i, 1) * b.
y +
a(i, 2) * b.
z +
a(i, 3) * b.
w; i++;
437 res.
w =
a(i, 0) * b.
x +
a(i, 1) * b.
y +
a(i, 2) * b.
z +
a(i, 3) * b.
w; i++;
446 float rotate_180_y[4][4] = { { -1, 0, 0, 0 },
450 matrix4 G_vr_body_to_tm2_body(rotate_180_y);
451 matrix4 G_vr_body_to_tm2_world = G_tm2_body_to_tm2_world * G_vr_body_to_tm2_body;
453 float rotate_90_x[4][4] = { { 1, 0, 0, 0 },
457 matrix4 G_tm2_world_to_vr_world(rotate_90_x);
458 matrix4 G_vr_body_to_vr_world = G_tm2_world_to_vr_world * G_vr_body_to_tm2_world;
460 return G_vr_body_to_vr_world;
478 bool mouse_down[2] {
false,
false };
480 float ui_wheel = 0.f;
486 if (min >= max)
return 0;
487 return ((in_val - min)/(max - min));
493 if (min == max)
return min;
494 return ((in_val * (max - min)) + min);
510 operator bool()
const 512 return w*w > 0 && h*h > 0;
517 return x == other.
x && y == other.
y && w == other.
w && h == other.
h;
522 return !(*
this == other);
528 normalizeT(y, normalize_to.
y, normalize_to.
y + normalize_to.
h),
536 unnormalizeT(y, unnormalize_to.
y, unnormalize_to.
y + unnormalize_to.
h),
545 auto x1 = std::max(x, other.
x);
546 auto y1 = std::max(y, other.
y);
552 std::max(
x2 -
x1, 0.
f),
553 std::max(
y2 - y1, 0.
f)
570 x1 = std::max(
x1, r.
x);
572 y1 = std::max(
y1, r.
y);
575 x2 = std::max(
x2, r.
x);
577 y2 = std::max(
y2, r.
y);
585 return (p.
x >= x) && (p.
x < x +
w) && (p.
y >= y) && (p.
y < y +
h);
590 return { x - p.
x, y - p.
y,
w, h };
595 return{ x + w / 2.f, y + h / 2.f, 0, 0 };
608 auto H =
static_cast<float>(
h),
W = static_cast<float>(h) * size.
x / size.
y;
616 return{ float(floor(x + floor(w -
W) / 2)),
617 float(floor(y + floor(h -
H) / 2)),
623 return {
x,
y, w * factor, h * factor };
628 return { x -
pixels, y -
pixels, w + pixels*2, h + pixels*2 };
633 return { x - dx, y - dy, w + dx*2, h + dy*2 };
638 return { x + pixels.
x, y + pixels.
y, w - pixels.
x * 2, h - pixels.
y * 2 };
644 auto diff_x = new_center.
x -
c.x;
645 auto diff_y = new_center.
y -
c.y;
647 return { x + diff_x, y + diff_y,
w, h };
662 return res.adjust_ratio({
w,h});
668 return scale(zoom_factor).center_at({
c.x,
c.y});
674 if (w > in_rect.
w || h > in_rect.
h)
681 out_rect.
x = in_rect.
x;
686 out_rect.y = in_rect.
y;
690 if (x + w > in_rect.
x + in_rect.
w)
692 out_rect.x = in_rect.
x + in_rect.
w -
w;
695 if (y + h > in_rect.
y + in_rect.
h)
697 out_rect.y = in_rect.
y + in_rect.
h -
h;
715 #include "../third-party/stb_easy_font.h" 740 for (
size_t i = 0;
i < values.size();
i++)
742 _map[(float)
i/(values.size()-1)] = values[
i];
751 if (_max == _min)
return *_data;
752 auto t = (
value - _min) / (_max - _min);
754 return _data[(int)(
t * (_size - 1))];
763 if (_map.size() == 0)
return {
value,
value, value };
765 if( _map.find(value) != _map.end() )
return _map.at(value);
767 if( value < _map.begin()->first )
return _map.begin()->second;
768 if( value > _map.rbegin()->first )
return _map.rbegin()->second;
770 auto lower = _map.lower_bound(value) == _map.begin() ? _map.begin() : --(_map.lower_bound(value)) ;
771 auto upper = _map.upper_bound(value);
773 auto t = (value - lower->first) / (upper->first - lower->first);
774 auto c1 = lower->second;
775 auto c2 = upper->second;
776 return lerp(c1, c2,
t);
781 if (_map.size() == 0)
return;
783 _min = _map.begin()->first;
784 _max = _map.rbegin()->first;
786 _cache.resize(steps + 1);
787 for (
int i = 0;
i <= steps;
i++)
789 auto t = (float)
i/steps;
790 auto x = _min +
t*(_max - _min);
795 _size = _cache.size();
796 _data = _cache.data();
813 using clock = std::chrono::steady_clock;
820 std::lock_guard<std::mutex>
lock(_m);
821 _measurements.push_back(std::make_pair(
clock::now(), val));
826 return get_stat() > 0.5f;
831 std::lock_guard<std::mutex>
lock(_m);
833 if (_t.get_elapsed() < _window)
return false;
835 _measurements.erase(std::remove_if(_measurements.begin(), _measurements.end(),
836 [
this](std::pair<clock::time_point, bool> pair) {
839 _measurements.end());
840 auto trues = std::count_if(_measurements.begin(), _measurements.end(),
841 [](std::pair<clock::time_point, bool> pair) {
844 return size_t(trues) / (float)_measurements.size();
849 std::lock_guard<std::mutex>
lock(_m);
851 _measurements.clear();
870 bool zoom_preview =
false;
886 auto idx = with_texture ? 1 : 0;
896 if (
auto gf = get_last_frame(
true).as<gl::gpu_frame>())
898 auto tex = gf.get_texture_id(texture_id);
932 frame = depth_decode->process(frame);
942 auto rendered_frame = frame;
948 height =
image.get_height();
949 stride =
image.get_stride_in_bytes();
959 stride = stride == 0 ? width :
stride;
978 data =
pc.get_texture_coordinates();
997 throw std::runtime_error(
"not a valid format");
999 throw std::runtime_error(
"unexpected format: Z16H. Check decoder processing block");
1015 if (
auto colorized_frame = colorize->colorize(frame).as<
video_frame>())
1019 data = colorized_frame.get_data();
1022 colorized_frame.get_width(),
1023 colorized_frame.get_height(),
1028 rendered_frame = colorized_frame;
1043 if (
auto colorized_frame = yuy2rgb->process(frame).as<
video_frame>())
1048 data = colorized_frame.get_data();
1051 colorized_frame.get_width(),
1052 colorized_frame.get_height(),
1054 colorized_frame.get_data());
1056 rendered_frame = colorized_frame;
1080 auto axes = motion.get_motion_data();
1085 throw std::runtime_error(
"Not expecting a frame with motion format that is not a motion_frame");
1107 throw std::runtime_error(
"Not expecting a frame with 6DOF format that is not a pose_frame");
1132 memset((
void*)
data, 0, height*width);
1145 last_queue[1].
enqueue(rendered_frame);
1155 glVertex3f(axis_size, -axis_size * 0.05f, 0.f);
1156 glVertex3f(axis_size, axis_size * 0.05f, 0.f);
1158 glVertex3f(axis_size, 0.f, -axis_size * 0.05f);
1159 glVertex3f(axis_size, 0.f, axis_size * 0.05f);
1166 glVertex3f(0.f, axis_size, 0.05f * axis_size);
1167 glVertex3f(0.f, axis_size, -0.05f * axis_size);
1169 glVertex3f( 0.05f * axis_size, axis_size, 0.f);
1170 glVertex3f(-0.05f * axis_size, axis_size, 0.f);
1177 glVertex3f(0.0f, 0.05f * axis_size, 1.0f * axis_size);
1178 glVertex3f(0.0f, -0.05f * axis_size, 1.0f * axis_size);
1180 glVertex3f(0.05f * axis_size, 0.f, 1.0f * axis_size);
1181 glVertex3f(-0.05f * axis_size, 0.f, 1.0f * axis_size);
1206 static void draw_circle(
float xx,
float xy,
float xz,
float yx,
float yy,
float yz,
float radius = 1.1,
float3 center = { 0.0, 0.0, 0.0 },
float intensity = 0.5f)
1209 glColor3f(intensity, intensity, intensity);
1213 for (
int i = 0;
i <= N;
i++)
1215 const double theta = (2 * M_PI / N) *
i;
1216 const auto cost =
static_cast<float>(cos(theta));
1217 const auto sint =
static_cast<float>(sin(theta));
1219 center.x + radius * (xx * cost + yx * sint),
1220 center.y + radius * (xy * cost + yy * sint),
1221 center.z + radius * (xz * cost + yz * sint)
1231 for (
int i = 0;
i < N;
i++)
1234 for (
int j = 0;
j < N;
j++)
1236 result[
i] += vec[
j] * mat[N*
j +
i];
1245 float tmp_result[4];
1248 const auto canvas_size = 230;
1250 multiply_vector_by_matrix(vec, model, tmp_result);
1251 multiply_vector_by_matrix(tmp_result, proj, result);
1253 return{ canvas_size * vec_norm *result[0], canvas_size * vec_norm *result[1] };
1258 auto xy = xyz_to_xy(x, y, z, model, proj, vec_norm);
1261 draw_text((
int)(xy.x -
w / 2), (
int)xy.y, text);
1278 glOrtho(-2.8, 2.8, -2.4, 2.4, -7, 7);
1284 float norm = std::sqrt(x*x + y*y + z*z);
1290 draw_circle(1, 0, 0, 0, 1, 0);
1291 draw_circle(0, 1, 0, 0, 0, 1);
1292 draw_circle(1, 0, 0, 0, 0, 1);
1294 const auto canvas_size = 230;
1295 const auto vec_threshold = 0.2f;
1296 if (norm < vec_threshold)
1298 const auto radius = 0.05;
1299 static const int circle_points = 100;
1300 static const float angle = 2.0f * 3.1416f / circle_points;
1304 double angle1 = 0.0;
1305 glVertex2d(radius * cos(0.0), radius * sin(0.0));
1307 for (i = 0; i < circle_points; i++)
1309 glVertex2d(radius * cos(angle1), radius *sin(angle1));
1316 auto vectorWidth = 5.f;
1331 glOrtho(-canvas_size, canvas_size, -canvas_size, canvas_size, -1, +1);
1333 std::ostringstream
s1;
1336 s1 << std::setprecision(
precision) << norm;
1337 print_text_in_3d(x / 2, y / 2, z / 2, s1.str().c_str(),
true,
model, proj, 1 / norm);
1355 for (
float x = -1.5;
x < 1.5;
x += step)
1357 for (
float y = -1.5;
y < 1.5;
y += step)
1413 if (!
image)
return false;
1423 *result = ptr[y * (
image.get_stride_in_bytes() /
sizeof(
uint16_t)) +
x];
1428 auto ptr = (
const float*)
image.get_data();
1429 *result = ptr[y * (
image.get_stride_in_bytes() /
sizeof(float)) +
x];
1436 *result = ptr[y *
image.get_stride_in_bytes() +
x];
1468 draw_texture(normalized_zoom, r);
1483 static const rect unit_square_coordinates{0, 0, 1, 1};
1484 static const float2 thumbnail_size = {141, 141};
1485 static const float2 thumbnail_margin = { 10, 27 };
1486 rect thumbnail{r.
x + r.
w, r.
y + r.
h, thumbnail_size.
x, thumbnail_size.
y };
1487 thumbnail = thumbnail.adjust_ratio({r.
w, r.
h}).enclose_in(r.
shrink_by(thumbnail_margin));
1490 if (r != zoomed_rect)
1492 draw_texture(unit_square_coordinates, thumbnail);
1495 static const auto top_line_offset = 0.5f;
1496 static const auto right_line_offset = top_line_offset / 2;
1499 glVertex2f(thumbnail.x - top_line_offset, thumbnail.y - top_line_offset);
1500 glVertex2f(thumbnail.x + thumbnail.w + right_line_offset / 2, thumbnail.y - top_line_offset);
1501 glVertex2f(thumbnail.x + thumbnail.w + right_line_offset / 2, thumbnail.y + thumbnail.h + top_line_offset);
1502 glVertex2f(thumbnail.x - top_line_offset, thumbnail.y + thumbnail.h + top_line_offset);
1505 curr_preview_rect = thumbnail;
1506 zoom_preview =
true;
1510 zoom_preview =
false;
1516 if (r != zoomed_rect)
1519 auto normalized_thumbnail_roi = normalized_zoom.unnormalize(thumbnail);
1523 glVertex2f(normalized_thumbnail_roi.x, normalized_thumbnail_roi.y);
1524 glVertex2f(normalized_thumbnail_roi.x, normalized_thumbnail_roi.y + normalized_thumbnail_roi.h);
1525 glVertex2f(normalized_thumbnail_roi.x + normalized_thumbnail_roi.w, normalized_thumbnail_roi.y + normalized_thumbnail_roi.h);
1526 glVertex2f(normalized_thumbnail_roi.x + normalized_thumbnail_roi.w, normalized_thumbnail_roi.y);
1527 glVertex2f(normalized_thumbnail_roi.x, normalized_thumbnail_roi.y);
1542 animated(
T def, std::chrono::system_clock::duration duration = std::chrono::milliseconds(200))
1543 : _duration(duration), _old(def), _new(def)
1561 auto ms = std::chrono::duration_cast<std::chrono::microseconds>(
now - _last_update).
count();
1562 auto duration_ms = std::chrono::duration_cast<std::chrono::microseconds>(_duration).
count();
1563 auto t = (float)ms / duration_ms;
1565 return static_cast<T>(_old * (1.f -
t) + _new *
t);
1567 operator T()
const {
return get(); }
1592 if (version / 10000 == 0)
return to_string() << version;
1593 return to_string() << (version / 10000) <<
"." << (version % 10000) / 100 <<
"." << (version % 100);
1598 template <
typename T>
1601 for (
const auto&
i : list) {
1628 return static_cast<float>(deg * (M_PI / 180.f));
1634 for (
int i = 0;
i < 4;
i++)
1635 for (
int j = 0;
j < 4;
j++)
1636 data.
mat[
i][
j] = (
i ==
j) ? 1.f : 0.f;
1646 return 0.5f * (sinf(2.
f *
float(M_PI) *
c -
float(M_PI_2)) + 1.f);
1686 for (
int i = 0;
i < 4;
i++)
1688 for (
int j = 0;
j < 4;
j++)
1697 auto mvp = pc * vc * fc;
1713 if (abs(p2d.
w) > 0.0)
1721 p2d.
x =
clamp(p2d.
x, -1.0, 1.0);
1722 p2d.
y =
clamp(p2d.
y, -1.0, 1.0);
1723 p2d.
z =
clamp(p2d.
z, -1.0, 1.0);
1726 float x_vp = round((p2d.
x + 1.f) / 2.f * vp[2]) + vp[0];
1727 float y_vp = round((p2d.
y + 1.f) / 2.f * vp[3]) + vp[1];
void draw_text(int x, int y, const char *text)
float smoothstep(float x, float min, float max)
float3 cross(const float3 &a, const float3 &b)
static const textual_icon lock
#define glDisableClientState
float lerp(float a, float b, float t)
GLuint get_gl_handle() const
bool intersects(const rect &other) const
#define GL_TEXTURE_MAG_FILTER
#define glEnableClientState
animated(T def, std::chrono::system_clock::duration duration=std::chrono::milliseconds(200))
GLboolean GLboolean GLboolean b
void show_preview(const rect &r, const rect &normalized_zoom=rect{0, 0, 1, 1})
void upload(rs2::frame frame, rs2_format prefered_format=RS2_FORMAT_ANY)
static matrix4 identity()
void add_timestamp(double timestamp, unsigned long long frame_counter)
bool operator==(const plane &lhs, const plane &rhs)
matrix4(const rs2_quaternion &q)
std::vector< std::pair< clock::time_point, bool > > _measurements
temporal_event(clock::duration window)
void draw_grid(float step)
GLenum GLenum GLenum GLenum GLenum scale
rect intersection(const rect &other) const
bool try_pick(int x, int y, float *result)
def axes(out, pos, rotation=np.eye(3), size=0.075, thickness=2)
GLdouble GLdouble GLdouble y2
color_map(const std::vector< float3 > &values, int steps=4000)
rect shrink_by(float2 pixels) const
std::enable_if< std::is_base_of< rs2::frame, T >::value, bool >::type poll_for_frame(T *output) const
static int stb_easy_font_print(float x, float y, char *text, unsigned char color[4], void *vertex_buffer, int vbuf_size)
const float & operator()(int i, int j) const
stream_profile get_profile() const
void enqueue(frame f) const
rect center_at(const float2 &new_center) const
unsigned long long _num_of_frames
rect pan(const float2 &p) const
rs2_quaternion to_quaternion()
color_map(std::map< float, float3 > map, int steps=4000)
std::vector< float3 > _cache
void operator=(const rect &other)
const void * get_data() const
std::array< float3, 4 > plane_3d
GLdouble GLdouble GLdouble w
GLsizei const GLchar *const * string
std::vector< plane_3d > subdivide(const plane_3d &rect, int parts=4)
float3 operator+(const float3 &a, const float3 &b)
std::chrono::steady_clock clock
GLfloat GLfloat GLfloat GLfloat h
rect unnormalize(const rect &unnormalize_to) const
float evaluate_plane(const plane &plane, const float3 &point)
::realsense_legacy_msgs::pose_< std::allocator< void > > pose
std::ostream & operator<<(std::ostream &os, const textual_icon &i)
GLenum GLenum GLsizei void * image
#define GL_TEXTURE_WRAP_T
bool is_valid(const plane_3d &p)
T unnormalizeT(const T &in_val, const T &min, const T &max)
GLboolean GLboolean GLboolean GLboolean a
const char * rs2_exception_type_to_string(rs2_exception_type type)
Quaternion used to represent rotation.
const std::string & get_failed_args() const
std::string error_to_string(const error &e)
T normalizeT(const T &in_val, const T &min, const T &max)
static void draw_circle(float xx, float xy, float xz, float yx, float yy, float yz, float radius=1.1, float3 center={0.0, 0.0, 0.0}, float intensity=0.5f)
rs2_pose correct_tm2_pose(const rs2_pose &pose)
bool contains(const std::shared_ptr< librealsense::device_info > &first, const std::shared_ptr< librealsense::device_info > &second)
GLfloat GLfloat GLfloat alpha
#define GL_COLOR_BUFFER_BIT
GLenum GLint GLint * precision
static const int _numerator
std::shared_ptr< depth_huffman_decoder > depth_decode
float3 operator-(const float3 &a, const float3 &b)
#define GL_PROJECTION_MATRIX
rs2::frame get_last_frame(bool with_texture=false) const
GLint GLsizei GLsizei height
#define GL_UNSIGNED_SHORT
float single_wave(float x)
GLint GLint GLsizei GLint GLenum format
float dot(const rs2::float2 &a, const rs2::float2 &b)
matrix4(const rs2_vector &t)
#define GL_TEXTURE_MIN_FILTER
rs2_intrinsics normalize(const rs2_intrinsics &intr)
float3 operator/(const float3 &a, float t)
rect grow(int pixels) const
GLdouble GLdouble GLint stride
std::chrono::system_clock::time_point _last_update
rs2_format
A stream's format identifies how binary data is encoded within a frame.
utilities::time::stopwatch _t
float3 operator*(const float3 &a, float t)
texture_buffer(const texture_buffer &other)
GLint GLint GLsizei GLint GLenum GLenum const void * pixels
std::shared_ptr< colorizer > colorize
rs2_exception_type get_type() const
void show(const rect &r, float alpha, const rect &normalized_zoom=rect{0, 0, 1, 1}) const
#define GL_ONE_MINUS_SRC_ALPHA
rect cut_by(const rect &r) const
bool is_rasterizeable(rs2_format format)
float2 xyz_to_xy(float x, float y, float z, GLfloat model[], GLfloat proj[], float vec_norm)
texture_buffer & operator=(const texture_buffer &other)
void draw_pose_data(const rs2_pose &pose, int id)
GLsizei const GLfloat * values
GLdouble GLdouble GLint GLint GLdouble v1
fps_calc(const fps_calc &other)
void print_text_in_3d(float x, float y, float z, const char *text, bool center_text, GLfloat model[], GLfloat proj[], float vec_norm)
rs2_format format() const
GLuint GLfloat GLfloat GLfloat x1
3D vector in Euclidean coordinate space
bool operator!=(const rect &other) const
bool val_in_range(const T &val, const std::initializer_list< T > &list)
GLdouble GLdouble GLdouble q
static int stb_easy_font_width(char *text)
#define GL_LUMINANCE_ALPHA
float3 calc(float value) const
void initialize(int steps)
std::map< float, float3 > _map
bool operator==(const rect &other) const
float clamp(float x, float min, float max)
rect scale(float factor) const
bool contains(const float2 &p) const
#define GL_MODELVIEW_MATRIX
std::string api_version_to_string(int version)
rect enclose_in(rect in_rect) const
rect normalize(const rect &normalize_to) const
unsigned long long _last_frame_counter
rect lerp(float t, const rect &other) const
static void draw_axes(float axis_size=1.f, float axisWidth=4.f)
rect adjust_ratio(float2 size) const
GLenum GLuint GLenum GLsizei length
matrix4 identity_matrix()
float & operator()(int i, int j)
void to_column_major(float column_major[16])
float2 translate_3d_to_2d(float3 point, matrix4 p, matrix4 v, matrix4 f, int32_t vp[4])
GLuint GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat s1
std::chrono::system_clock::duration _duration
rect grow(int dx, int dy) const
void multiply_vector_by_matrix(GLfloat vec[], GLfloat mat[], GLfloat *result)
std::shared_ptr< yuy_decoder > yuy2rgb
void draw_motion_data(float x, float y, float z)
animated & operator=(const T &other)
matrix4(float vals[4][4])
rs2_quaternion normalize(rs2_quaternion a)
matrix4 tm2_pose_to_world_transformation(const rs2_pose &pose)
void draw_texture(const rect &s, const rect &t) const
rect zoom(float zoom_factor) const
#define GL_TEXTURE_WRAP_S
static const int _skip_frames
void upload_image(int w, int h, void *data, int format=GL_RGBA)
GeneratorWrapper< T > map(Func &&function, GeneratorWrapper< U > &&generator)
const std::string & get_failed_function() const
std::string to_string(T value)