22 template<
typename GetTrianglesT>
31 "Polyhedron callback must return a vector of triangles with points ordered clockwise, expressed as "
32 "an std::vector<std::array<double, 3>>");
57 template<
typename GetVerticesT,
typename GetTrianglesT>
64 GetVerticesT get_vertices_fn,
65 GetTrianglesT get_triangles_fn)
69 "Polyhedron vertices callback must return a vector of 3D points");
71 "Polyhedron triangles callback must return a list of 3-uple index into vertices array");
98 template<
typename PolyhedronT,
typename GetColorT>
107 "Polyhedron color callback must return an std::vector<std::array<mc_rtc::gui::Color, 3>> (color for "
108 "each of the triangle vertices)");
113 "Polyhedron color callback must return an std::vector<mc_rtc::gui::Color> (color for "
114 "each of the vertices)");
121 static constexpr
size_t write_size() {
return PolyhedronT::write_size() + 1; }
128 for(
const auto & c : colors)
153 template<
typename GetTrianglesT>
154 auto Polyhedron(
const std::string & name, GetTrianglesT get_triangles_fn)
158 template<
typename GetTrianglesT>
163 template<
typename GetVerticesOrTrianglesT,
typename GetTrianglesOrColorsT>
165 GetVerticesOrTrianglesT get_vertices_or_triangles_fn,
166 GetTrianglesOrColorsT get_triangles_or_colors_fn)
172 get_triangles_or_colors_fn);
177 name, {}, get_vertices_or_triangles_fn, get_triangles_or_colors_fn);
182 template<
typename GetVerticesOrTrianglesT,
typename GetTrianglesOrColorsT>
185 GetVerticesOrTrianglesT get_vertices_or_triangles_fn,
186 GetTrianglesOrColorsT get_triangles_or_colors_fn)
190 auto poly =
Polyhedron(name, config, get_vertices_or_triangles_fn);
192 get_triangles_or_colors_fn);
197 name, config, get_vertices_or_triangles_fn, get_triangles_or_colors_fn);
202 template<
typename GetTrianglesT,
typename GetColorT>
205 GetTrianglesT get_triangles_fn,
206 GetColorT get_color_fn)
208 auto poly =
Polyhedron(name, config, get_triangles_fn);
213 template<
typename GetVerticesT,
typename GetTrianglesT,
typename GetColorT>
215 GetVerticesT get_vertices_fn,
216 GetTrianglesT get_triangles_fn,
217 GetColorT get_color_fn)
219 auto poly =
Polyhedron(name, get_vertices_fn, get_triangles_fn);
224 template<
typename GetVerticesT,
typename GetTrianglesT,
typename GetColorT>
227 GetVerticesT get_vertices_fn,
228 GetTrianglesT get_triangles_fn,
229 GetColorT get_color_fn)
231 auto poly =
Polyhedron(name, config, get_vertices_fn, get_triangles_fn);
std::optional< Eigen::VectorXd > value
auto write(T &value)
Definition: traits.h:226
Definition: Observer.h:16
auto Polyhedron(const std::string &name, GetTrianglesT get_triangles_fn)
Definition: Polyhedron.h:154
@ PolyhedronVerticesTriangles
@ PolyhedronTrianglesList
auto ColoredPolyhedron(const std::string &name, const PolyhedronConfig &config, GetTrianglesT get_triangles_fn, GetColorT get_color_fn)
Definition: Polyhedron.h:203
Definition: MessagePackBuilder.h:87
void start_array(size_t size)
Definition: elements.h:59
const std::string & name() const
Definition: elements.h:61
static constexpr size_t write_size()
Definition: elements.h:76
static constexpr size_t write_size()
Definition: types.h:446
void write(mc_rtc::MessagePackBuilder &out) const
Default triangle face color.
Definition: types.h:448
Definition: Polyhedron.h:100
ColoredPolyhedronImpl()
Definition: Polyhedron.h:119
GetColorT get_color_fn_
Definition: Polyhedron.h:147
ColoredPolyhedronImpl(PolyhedronT &&poly, GetColorT get_color_fn)
Definition: Polyhedron.h:101
void write(mc_rtc::MessagePackBuilder &builder)
Definition: Polyhedron.h:123
static constexpr size_t write_size()
Definition: Polyhedron.h:121
Definition: Polyhedron.h:24
PolyhedronTrianglesListImpl(const std::string &name, const PolyhedronConfig &config, GetTrianglesT get_triangles_fn)
Definition: Polyhedron.h:27
void write(mc_rtc::MessagePackBuilder &builder)
Definition: Polyhedron.h:40
GetTrianglesT get_triangles_fn_
Definition: Polyhedron.h:48
static constexpr size_t write_size()
Definition: Polyhedron.h:38
PolyhedronConfig config_
Definition: Polyhedron.h:47
PolyhedronTrianglesListImpl()
Definition: Polyhedron.h:36
static constexpr auto type
Definition: Polyhedron.h:25
Definition: Polyhedron.h:59
GetTrianglesT get_triangles_fn_
Definition: Polyhedron.h:89
GetVerticesT get_vertices_fn_
Definition: Polyhedron.h:88
PolyhedronVerticesTrianglesImpl()
Definition: Polyhedron.h:75
PolyhedronVerticesTrianglesImpl(const std::string &name, const PolyhedronConfig &config, GetVerticesT get_vertices_fn, GetTrianglesT get_triangles_fn)
Definition: Polyhedron.h:62
static constexpr size_t write_size()
Definition: Polyhedron.h:77
void write(mc_rtc::MessagePackBuilder &builder)
Definition: Polyhedron.h:79
static constexpr auto type
Definition: Polyhedron.h:60
PolyhedronConfig config_
Definition: Polyhedron.h:87