4#include "MRViewer/exports.h"
17 ImDrawList*
list = ImGui::GetBackgroundDrawList();
103 MRVIEWER_API
void draw( ImDrawList& list,
float menuScaling, ImVec2 pos, ImU32 color );
112 ImVec2 push = {}, ImVec2 pivot = { 0.5f, 0.5f } );
175 [[nodiscard]] ImVec2
endPoint(
bool second )
const {
return second ?
b :
a; }
193template <
typename A,
typename B,
typename F,
typename G,
typename H = std::
nullptr_t>
195 F&& stateToPoint, G&& bisectState, H&& onInsertPoint =
nullptr
200 std::size_t firstIndex = pointBuffer.size();
202 auto makeCurve = [&](
auto makeCurve,
int depth,
const auto& stateA,
const auto& stateB, ImVec2 pointA, ImVec2 pointB ) ->
void
209 auto midState = bisectState( stateA, stateB,
int(
depth ) );
210 ImVec2 midPoint = stateToPoint( midState );
212 makeCurve( makeCurve,
depth + 1, stateA, midState, pointA, midPoint );
213 makeCurve( makeCurve,
depth + 1, midState, stateB, midPoint, pointB );
219 onInsertPoint( pointB, stateB );
220 pointBuffer.push_back( pointB );
224 ImVec2 firstPoint = stateToPoint( stateA );
225 makeCurve( makeCurve, 0, stateA, stateB, firstPoint, stateToPoint( stateB ) );
228 pointBuffer.pop_back();
229 ret.midPoints = { pointBuffer.data() + firstIndex, pointBuffer.data() + pointBuffer.size() };
#define MR_MAKE_FLAG_OPERATORS(T)
Definition MRFlagOperators.h:6
auto depth(const Box< V > &box)
returns size along z axis
Definition MRMesh/MRBox.h:261
constexpr auto lengthSq(A a)
Definition MRImGuiVectorOperators.h:131
Definition MRImGuiMeasurementIndicators.h:13
MRVIEWER_API void text(Element elem, float menuScaling, const Params ¶ms, ImVec2 pos, StringWithIcon string, ImVec2 push={}, ImVec2 pivot={ 0.5f, 0.5f })
MRVIEWER_API void point(Element elem, float menuScaling, const Params ¶ms, ImVec2 point)
StringIcon
Definition MRImGuiMeasurementIndicators.h:73
MRVIEWER_API void line(Element elem, float menuScaling, const Params ¶ms, ImVec2 a, ImVec2 b, const LineParams &lineParams={})
MRVIEWER_API void arrowTriangle(Element elem, float menuScaling, const Params ¶ms, ImVec2 point, ImVec2 dir)
PreparedCurve prepareCurve(const CurveParams &curveParams, std::vector< ImVec2 > &pointBuffer, const A &stateA, const B &stateB, F &&stateToPoint, G &&bisectState, H &&onInsertPoint=nullptr)
Definition MRImGuiMeasurementIndicators.h:194
LineFlags
Definition MRImGuiMeasurementIndicators.h:130
@ noBackwardArrowTipOffset
Element
Definition MRImGuiMeasurementIndicators.h:62
MRVIEWER_API void distance(Element elem, float menuScaling, const Params ¶ms, ImVec2 a, ImVec2 b, StringWithIcon string, const DistanceParams &distanceParams={})
Definition MRImGuiMeasurementIndicators.h:160
int maxSubdivisionDepth
Definition MRImGuiMeasurementIndicators.h:162
float subdivisionStepPixels
Definition MRImGuiMeasurementIndicators.h:167
int minSubdivisionDepth
Definition MRImGuiMeasurementIndicators.h:164
Definition MRImGuiMeasurementIndicators.h:150
std::optional< bool > moveTextToLineEndIndex
Definition MRImGuiMeasurementIndicators.h:152
Definition MRImGuiMeasurementIndicators.h:118
StringWithIcon text
Definition MRImGuiMeasurementIndicators.h:126
Decoration decoration
Definition MRImGuiMeasurementIndicators.h:124
Decoration
Definition MRImGuiMeasurementIndicators.h:120
Definition MRImGuiMeasurementIndicators.h:137
std::span< const ImVec2 > midPoints
Definition MRImGuiMeasurementIndicators.h:143
Definition MRImGuiMeasurementIndicators.h:16
float width
Definition MRImGuiMeasurementIndicators.h:25
float smallWidth
Definition MRImGuiMeasurementIndicators.h:26
float totalLenThreshold
Definition MRImGuiMeasurementIndicators.h:46
float arrowHalfWidth
Definition MRImGuiMeasurementIndicators.h:32
float arrowLen
Definition MRImGuiMeasurementIndicators.h:31
float textToLineSpacingRadius
Definition MRImGuiMeasurementIndicators.h:42
float notchHalfLen
Definition MRImGuiMeasurementIndicators.h:55
float textOutlineWidth
Definition MRImGuiMeasurementIndicators.h:28
float leaderLineLen
Definition MRImGuiMeasurementIndicators.h:52
Color colorOutline
Definition MRImGuiMeasurementIndicators.h:19
float arrowTipBackwardOffset
Definition MRImGuiMeasurementIndicators.h:36
Color colorMain
Definition MRImGuiMeasurementIndicators.h:18
Color colorTextOutline
Definition MRImGuiMeasurementIndicators.h:21
ImVec2 textToLineSpacingB
Definition MRImGuiMeasurementIndicators.h:40
float pointDiameter
Definition MRImGuiMeasurementIndicators.h:23
ImDrawList * list
Definition MRImGuiMeasurementIndicators.h:17
Color colorText
Definition MRImGuiMeasurementIndicators.h:20
ImVec2 textToLineSpacingA
Definition MRImGuiMeasurementIndicators.h:39
float outlineWidth
Definition MRImGuiMeasurementIndicators.h:27
float invertedOverhang
Definition MRImGuiMeasurementIndicators.h:49
float textOutlineRounding
Definition MRImGuiMeasurementIndicators.h:29
Definition MRImGuiMeasurementIndicators.h:171
ImVec2 a
Definition MRImGuiMeasurementIndicators.h:172
ImVec2 b
Definition MRImGuiMeasurementIndicators.h:173
std::span< ImVec2 > midPoints
Definition MRImGuiMeasurementIndicators.h:177
ImVec2 endPoint(bool second) const
Definition MRImGuiMeasurementIndicators.h:175
Definition MRImGuiMeasurementIndicators.h:80
MRVIEWER_API void draw(ImDrawList &list, float menuScaling, ImVec2 pos, ImU32 color)
StringWithIcon(const char *string)
Definition MRImGuiMeasurementIndicators.h:89
StringWithIcon(std::string string)
Definition MRImGuiMeasurementIndicators.h:90
MRVIEWER_API float getIconWidth() const
StringIcon icon
Definition MRImGuiMeasurementIndicators.h:81
StringWithIcon()
Definition MRImGuiMeasurementIndicators.h:86
bool isEmpty() const
Definition MRImGuiMeasurementIndicators.h:96
std::size_t iconPos
Definition MRImGuiMeasurementIndicators.h:82
std::string string
Definition MRImGuiMeasurementIndicators.h:84
MRVIEWER_API ImVec2 calcTextSize() const
StringWithIcon(StringIcon icon, std::size_t iconPos, std::string string)
Definition MRImGuiMeasurementIndicators.h:92