Classes | |
| struct | CurveParams |
| struct | DistanceParams |
| struct | DistanceResult |
| struct | LineBodyParams |
| struct | LineCap |
| struct | LineParams |
| struct | LineResult |
| struct | Params |
| struct | PreparedCurve |
| struct | Stipple |
| Parameters for drawing dotted lines. More... | |
| struct | Text |
| Represents an arbitrary block of text, possibly with icons, colors, etc. More... | |
| struct | TextColor |
| struct | TextFont |
| struct | TextParams |
| struct | TextResult |
Enumerations | |
| enum class | Element { main = 1 << 0 , outline = 1 << 1 , both = main | outline } |
| enum class | TextIcon { diameter } |
| enum class | LineCapDecoration { none , noOutline , extend , arrow , point } |
| enum class | LineFlags { narrow = 1 << 0 , noBackwardArrowTipOffset = 1 << 1 , onlyOutline = 1 << 2 } |
Functions | |
| MRVIEWER_API void | point (Element elem, const Params ¶ms, ImVec2 point) |
| Draws a point. | |
| MRVIEWER_API std::optional< TextResult > | text (Element elem, const Params ¶ms, ImVec2 pos, const Text &text, const TextParams &textParams={}, ImVec2 push={}, ImVec2 pivot={ 0.5f, 0.5f }) |
| MRVIEWER_API void | arrowTriangle (Element elem, const Params ¶ms, ImVec2 point, ImVec2 dir) |
| Draws a triangle from an arrow. | |
| MRVIEWER_API std::optional< LineResult > | line (Element elem, const Params ¶ms, ImVec2 a, ImVec2 b, const LineParams &lineParams={}) |
| Draws a line or an arrow. | |
| MRVIEWER_API std::optional< DistanceResult > | distance (Element elem, const Params ¶ms, ImVec2 a, ImVec2 b, const Text &text, const DistanceParams &distanceParams={}) |
| template<typename A , typename B , typename F , typename G , typename H = std::nullptr_t> | |
| PreparedCurve | prepareCurve (const CurveParams &curveParams, std::vector< ImVec2 > &pointBuffer, const A &stateA, const B &stateB, F &&stateToPoint, G &&bisectState, H &&onInsertPoint=nullptr) |
|
strong |
|
strong |
|
strong |
|
strong |
| MRVIEWER_API void MR::ImGuiMeasurementIndicators::arrowTriangle | ( | Element | elem, |
| const Params & | params, | ||
| ImVec2 | point, | ||
| ImVec2 | dir ) |
Draws a triangle from an arrow.
| MRVIEWER_API std::optional< DistanceResult > MR::ImGuiMeasurementIndicators::distance | ( | Element | elem, |
| const Params & | params, | ||
| ImVec2 | a, | ||
| ImVec2 | b, | ||
| const Text & | text, | ||
| const DistanceParams & | distanceParams = {} ) |
Draws a distance arrow between two points, automatically selecting the best visual style. The string is optional.
| MRVIEWER_API std::optional< LineResult > MR::ImGuiMeasurementIndicators::line | ( | Element | elem, |
| const Params & | params, | ||
| ImVec2 | a, | ||
| ImVec2 | b, | ||
| const LineParams & | lineParams = {} ) |
Draws a line or an arrow.
| MRVIEWER_API void MR::ImGuiMeasurementIndicators::point | ( | Element | elem, |
| const Params & | params, | ||
| ImVec2 | point ) |
Draws a point.
|
nodiscard |
Calculates points for a custom curve, from a function you provide. You can then draw this curve as a line(). The points are appended into pointBuffer (and for convenience the new points are also returned as .midPoints; the first and the last point are not inserted into the vector and are not included in .midPoints, they sit in .a and .b). You should reuse pointBuffer between calls for better performance (and .clear() it each time you finish drawing the resulting curve, which conveniently preserves vector capacity). Or, if you don't care, just pass an empty vector, and keep it alive as long as you need the curve. stateA and stateB can have any type, they describe the beginning and the end of the curve respectively. They might often be 0.f and 1.f. Let S be the type of stateA/stateB (more on that belw). stateToPoint is a lambda (const S &s) -> ImVec2. It converts a state into a curve point coordinates. bisectState is a lambda (const S &a, const S &b, int depth) -> S. Given two states, it produces the state between them. depth starts at 0. onInsertPoint, if specified, is a lambda (ImVec2 point, const S &state) -> void. It's called right before a point is added into the list. It's actually possible to have multiple state types instead of a single S, and template your functions (e.g. to track bisection depth in the type system, etc). Example usage: prepareCurve( params, buf, 0, PI*2, [](float x){return std::sin(x);}, [](float a, float b, int /** depth*/){return (a+b)/2;} )
Check if we need to subdivide.
Do subdivide.
A cast to prevent modification.
No subdivide.
| MRVIEWER_API std::optional< TextResult > MR::ImGuiMeasurementIndicators::text | ( | Element | elem, |
| const Params & | params, | ||
| ImVec2 | pos, | ||
| const Text & | text, | ||
| const TextParams & | textParams = {}, | ||
| ImVec2 | push = {}, | ||
| ImVec2 | pivot = { 0.5f, 0.5f } ) |
Draws a floating text bubble. If push is specified, it's normalized and the text is pushed in that direction, by the amount necessarily to clear a perpendicular going through the center point. If pivot is specified, the bubble is positioned according to its size (like in ImGui::SetNextWindowPos): { 0, 0 } for top left corner, { 0.5f, 0.5f } for center (default), { 1, 1 } for bottom right corner.