guillaume 2026.6.1
A C++ UI framework designed for modern desktop and extended reality (XR) applications.
Loading...
Searching...
No Matches
shape_mesh.hpp
Go to the documentation of this file.
1/*
2 Copyright (c) 2026 ETIB Corporation
3
4 Permission is hereby granted, free of charge, to any person obtaining a copy of
5 this software and associated documentation files (the "Software"), to deal in
6 the Software without restriction, including without limitation the rights to
7 use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
8 of the Software, and to permit persons to whom the Software is furnished to do
9 so, subject to the following conditions:
10
11 The above copyright notice and this permission notice shall be included in all
12 copies or substantial portions of the Software.
13
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 SOFTWARE.
21 */
22
23#pragma once
24
44
45#include <vector>
46
47#include <utility/graphic/color.hpp>
48#include <utility/graphic/mesh.hpp>
49#include <utility/graphic/orientation.hpp>
50#include <utility/graphic/pose.hpp>
51#include <utility/math/vector.hpp>
52
53namespace guillaume::systems::shape
54{
61 utility::graphic::PositionF rotatePositionByQuaternion(
62 const utility::graphic::PositionF &position,
63 const utility::graphic::OrientationF &orientation);
64
75 std::vector<utility::graphic::PositionF> transformToWorldVertices(
76 const std::vector<utility::math::Vector2F> &localVertices,
77 const utility::graphic::PositionF &center,
78 const utility::graphic::OrientationF &orientation);
79
88 bool isInvisible(const utility::graphic::Color32Bit &color);
89
101 utility::graphic::Color32Bit
102 opaqueColor(const utility::graphic::Color32Bit &color);
103
110 utility::graphic::VertexF
111 createVertex(const utility::graphic::PositionF &position,
112 const utility::graphic::Color32Bit &color);
113
128 utility::graphic::Mesh &mesh, const utility::graphic::PositionF &center,
129 const std::vector<utility::graphic::PositionF> &outline,
130 const utility::graphic::Color32Bit &color);
131
158 void buildRingMesh(utility::graphic::Mesh &mesh,
159 const utility::graphic::PositionF &center,
160 const utility::graphic::OrientationF &orientation,
161 float outerHalfWidth, float outerHalfHeight,
162 float thickness, float startAngle, float sweepAngle,
163 int segments, bool closed,
164 const utility::graphic::Color32Bit &color);
165
187 void buildLineMesh(utility::graphic::Mesh &mesh,
188 const utility::graphic::PositionF &center,
189 const utility::graphic::OrientationF &orientation,
190 float halfLength, float halfThickness, bool dashed,
191 float dashLength, float gapLength,
192 const utility::graphic::Color32Bit &color);
193
218 utility::graphic::Mesh &mesh, const utility::graphic::PositionF &center,
219 const utility::graphic::OrientationF &orientation, float halfWidth,
220 float halfHeight, float radius, float width, int arcSegments,
221 const utility::graphic::Color32Bit &color);
222
223} // namespace guillaume::systems::shape
void buildRoundedStrokeMesh(utility::graphic::Mesh &mesh, const utility::graphic::PositionF &center, const utility::graphic::OrientationF &orientation, float halfWidth, float halfHeight, float radius, float width, int arcSegments, const utility::graphic::Color32Bit &color)
Build the border of a rounded rectangle as a band of constant width.
void buildLineMesh(utility::graphic::Mesh &mesh, const utility::graphic::PositionF &center, const utility::graphic::OrientationF &orientation, float halfLength, float halfThickness, bool dashed, float dashLength, float gapLength, const utility::graphic::Color32Bit &color)
Build a straight stroke along X, solid or dashed.
utility::graphic::VertexF createVertex(const utility::graphic::PositionF &position, const utility::graphic::Color32Bit &color)
Make a mesh vertex from a position and a color.
void buildRingMesh(utility::graphic::Mesh &mesh, const utility::graphic::PositionF &center, const utility::graphic::OrientationF &orientation, float outerHalfWidth, float outerHalfHeight, float thickness, float startAngle, float sweepAngle, int segments, bool closed, const utility::graphic::Color32Bit &color)
Build a ring, or a part of one, as a strip of triangles.
bool isInvisible(const utility::graphic::Color32Bit &color)
Whether a color draws nothing.
void buildTriangleFanVertices(utility::graphic::Mesh &mesh, const utility::graphic::PositionF &center, const std::vector< utility::graphic::PositionF > &outline, const utility::graphic::Color32Bit &color)
Fill a closed outline with a fan of triangles around its center.
utility::graphic::PositionF rotatePositionByQuaternion(const utility::graphic::PositionF &position, const utility::graphic::OrientationF &orientation)
Rotate a 3D point around the origin by a quaternion.
utility::graphic::Color32Bit opaqueColor(const utility::graphic::Color32Bit &color)
Turn a translucent color into the opaque color it looks like.
std::vector< utility::graphic::PositionF > transformToWorldVertices(const std::vector< utility::math::Vector2F > &localVertices, const utility::graphic::PositionF &center, const utility::graphic::OrientationF &orientation)
Move 2D points of a shape's plane into world space.