MeshLib C++ Docs
Loading...
Searching...
No Matches
MRRenderDimensions.h
Go to the documentation of this file.
1#pragma once
2
3#include "MRMesh/MRColor.h"
5#include "MRMesh/MRVector2.h"
7#include "MRViewer/exports.h"
8
9#include <optional>
10
11namespace MR
12{
15
16class Viewport;
17}
18
20{
21
23{
24 float positive = 0;
25 float negative = 0;
26};
27
29{
32 const VisualObject* objectToSelect = nullptr;
33
35 std::string objectName;
36};
37
39{
41
42 Vector3f point;
43
46 ImVec2 align = ImVec2( 1, 1 );
47
49 std::optional<Vector3f> referencePoint;
50
55
58 std::optional<Tolerance> tolerance;
59
61 bool capIsVisible = true;
62};
63
65{
66 Viewport* viewport_ = nullptr;
67 Color color_;
68 PointParams params_;
69
70public:
72
73 MRVIEWER_API PointTask( const UiRenderParams& uiParams, const AffineXf3f& xf, Color color, const PointParams& params );
74 MRVIEWER_API void renderPass() override;
75
77 MRVIEWER_API void onClick() override;
78};
79
81{
83
85 Vector3f center;
86
88 Vector3f radiusAsVector = Vector3f( 1, 0, 0 );
89
91 Vector3f normal = Vector3f( 0, 0, 1 );
92
94 bool drawAsDiameter = false;
95
97 bool isSpherical = false;
98
101 float visualLengthMultiplier = 2 / 3.f;
102};
103
105{
106 Viewport* viewport_ = nullptr;
107 Color color_;
108 RadiusParams params_;
109
110public:
112
113 MRVIEWER_API RadiusTask( const UiRenderParams& uiParams, const AffineXf3f& xf, Color color, const RadiusParams& params );
114 MRVIEWER_API void renderPass() override;
115
117 MRVIEWER_API void onClick() override;
118};
119
121{
123
125 Vector3f center;
126
129 std::array<Vector3f, 2> rays;
130
132 bool isConical = false;
133
135 std::array<bool, 2> shouldVisualizeRay{ true, true };
136};
137
139{
140 Viewport* viewport_ = nullptr;
141 Color color_;
142 AngleParams params_;
143
144public:
146 MRVIEWER_API AngleTask( const UiRenderParams& uiParams, const AffineXf3f& xf, Color color, const AngleParams& params );
147 MRVIEWER_API void renderPass() override;
148
150 MRVIEWER_API void onClick() override;
151};
152
153
155{
157
159 std::array<Vector3f, 2> points;
160
162 bool drawAsNegative = false;
163
165 std::optional<int> onlyOneAxis;
166
168 std::optional<float> referenceValue;
169
171 std::optional<Tolerance> tolerance;
172};
173
175{
176 Viewport* viewport_ = nullptr;
177 Color color_;
178 LengthParams params_;
179
181 MRVIEWER_API Vector3f computeCornerPoint();
182
183public:
185 MRVIEWER_API LengthTask( const UiRenderParams& uiParams, const AffineXf3f& xf, Color color, const LengthParams& params );
186 MRVIEWER_API void renderPass() override;
187
189 MRVIEWER_API void onClick() override;
190};
191
192}
Definition MRRenderClickableRect.h:17
Definition MRRenderDimensions.h:139
Definition MRRenderDimensions.h:175
Definition MRRenderDimensions.h:65
Definition MRRenderDimensions.h:105
Definition MRViewport.h:49
Visual Object.
Definition MRVisualObject.h:116
bool drawAsDiameter
Whether we should draw this as a diameter instead of a radius.
Definition MRRenderDimensions.h:94
bool isSpherical
Whether this is a sphere radius, as opposed to circle/cylinder radius.
Definition MRRenderDimensions.h:97
float visualLengthMultiplier
Definition MRRenderDimensions.h:101
const VisualObject * objectToSelect
Definition MRRenderDimensions.h:32
LengthTask()
Definition MRRenderDimensions.h:184
MRVIEWER_API RadiusTask(const UiRenderParams &uiParams, const AffineXf3f &xf, Color color, const RadiusParams &params)
std::array< Vector3f, 2 > points
The points between which we're measuring.
Definition MRRenderDimensions.h:159
std::array< Vector3f, 2 > rays
Definition MRRenderDimensions.h:129
float positive
Definition MRRenderDimensions.h:24
float negative
Should be positive or zero.
Definition MRRenderDimensions.h:25
AngleTask()
Definition MRRenderDimensions.h:145
std::optional< Tolerance > tolerance
Definition MRRenderDimensions.h:58
RadiusTask()
Definition MRRenderDimensions.h:111
MRVIEWER_API void onClick() override
Implement BasicClickableRectUiRenderTask:
MRVIEWER_API LengthTask(const UiRenderParams &uiParams, const AffineXf3f &xf, Color color, const LengthParams &params)
bool drawAsNegative
Whether the distance should be displayed as a negative one.
Definition MRRenderDimensions.h:162
MRVIEWER_API void onClick() override
Implement BasicClickableRectUiRenderTask:
std::optional< Vector3f > referencePoint
If specified, we're comparing point against this position.
Definition MRRenderDimensions.h:49
Vector3f radiusAsVector
The length of this is the radius. This is also the preferred drawing direction relative to center.
Definition MRRenderDimensions.h:88
bool capIsVisible
Whether to draw the cap or not.
Definition MRRenderDimensions.h:61
CommonParams common
Definition MRRenderDimensions.h:82
MRVIEWER_API void renderPass() override
This is the main rendering pass.
MRVIEWER_API void onClick() override
Implement BasicClickableRectUiRenderTask:
MRVIEWER_API void renderPass() override
This is the main rendering pass.
PointTask()
Definition MRRenderDimensions.h:71
std::optional< int > onlyOneAxis
If set, use only once axis (with this index, 0..2) instead of euclidean.
Definition MRRenderDimensions.h:165
MRVIEWER_API void renderPass() override
This is the main rendering pass.
std::string objectName
Optional. If specified, this name is drawn above the measurement.
Definition MRRenderDimensions.h:35
Vector3f center
The center point.
Definition MRRenderDimensions.h:125
CommonParams common
Definition MRRenderDimensions.h:156
std::array< bool, 2 > shouldVisualizeRay
Whether we should draw a ray from the center point to better visualize the angle. Enable this if ther...
Definition MRRenderDimensions.h:135
Vector3f referenceNormal
Definition MRRenderDimensions.h:54
Vector3f normal
The preferred normal for non-spherical radiuses. The length is ignored, and this is automatically adj...
Definition MRRenderDimensions.h:91
ImVec2 align
The world point.
Definition MRRenderDimensions.h:46
Vector3f point
Definition MRRenderDimensions.h:42
MRVIEWER_API AngleTask(const UiRenderParams &uiParams, const AffineXf3f &xf, Color color, const AngleParams &params)
Vector3f center
The center point.
Definition MRRenderDimensions.h:85
bool isConical
Whether this is a conical angle. The middle line between the rays is preserved, but the rays themselv...
Definition MRRenderDimensions.h:132
MRVIEWER_API void renderPass() override
This is the main rendering pass.
std::optional< float > referenceValue
If set, we're comparing the distance with a reference value.
Definition MRRenderDimensions.h:168
MRVIEWER_API PointTask(const UiRenderParams &uiParams, const AffineXf3f &xf, Color color, const PointParams &params)
CommonParams common
Definition MRRenderDimensions.h:122
CommonParams common
Definition MRRenderDimensions.h:40
std::optional< Tolerance > tolerance
Tolerances. Only make sense if referenceValue is set.
Definition MRRenderDimensions.h:171
MRVIEWER_API void onClick() override
Implement BasicClickableRectUiRenderTask:
Definition MRRenderDimensions.h:20
only for bindings generation
Definition MRCameraOrientationPlugin.h:8
Definition MRColor.h:12
Definition MRRenderDimensions.h:121
Definition MRRenderDimensions.h:29
Definition MRRenderDimensions.h:155
Definition MRRenderDimensions.h:39
Definition MRRenderDimensions.h:81
Definition MRRenderDimensions.h:23
Definition MRIRenderObject.h:110