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)
138 else { c.write(builder); }
150 template<
typename GetTrianglesT>
151 auto Polyhedron(
const std::string & name, GetTrianglesT get_triangles_fn)
157 template<
typename GetTrianglesT>
164 template<
typename GetVerticesOrTrianglesT,
typename GetTrianglesOrColorsT>
166 GetVerticesOrTrianglesT get_vertices_or_triangles_fn,
167 GetTrianglesOrColorsT get_triangles_or_colors_fn)
173 get_triangles_or_colors_fn);
178 name, {}, get_vertices_or_triangles_fn, get_triangles_or_colors_fn);
183 template<
typename GetVerticesOrTrianglesT,
typename GetTrianglesOrColorsT>
186 GetVerticesOrTrianglesT get_vertices_or_triangles_fn,
187 GetTrianglesOrColorsT get_triangles_or_colors_fn)
191 auto poly =
Polyhedron(name, config, get_vertices_or_triangles_fn);
193 get_triangles_or_colors_fn);
198 name, config, get_vertices_or_triangles_fn, get_triangles_or_colors_fn);
203 template<
typename GetTrianglesT,
typename GetColorT>
206 GetTrianglesT get_triangles_fn,
207 GetColorT get_color_fn)
209 auto poly =
Polyhedron(name, config, get_triangles_fn);
214 template<
typename GetVerticesT,
typename GetTrianglesT,
typename GetColorT>
216 GetVerticesT get_vertices_fn,
217 GetTrianglesT get_triangles_fn,
218 GetColorT get_color_fn)
220 auto poly =
Polyhedron(name, get_vertices_fn, get_triangles_fn);
225 template<
typename GetVerticesT,
typename GetTrianglesT,
typename GetColorT>
228 GetVerticesT get_vertices_fn,
229 GetTrianglesT get_triangles_fn,
230 GetColorT get_color_fn)
232 auto poly =
Polyhedron(name, config, get_vertices_fn, get_triangles_fn);
auto write(T &value)
Definition: traits.h:224
Definition: Observer.h:16
auto Polyhedron(const std::string &name, GetTrianglesT get_triangles_fn)
Definition: Polyhedron.h:151
@ PolyhedronVerticesTriangles
@ PolyhedronTrianglesList
auto ColoredPolyhedron(const std::string &name, const PolyhedronConfig &config, GetTrianglesT get_triangles_fn, GetColorT get_color_fn)
Definition: Polyhedron.h:204
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:445
void write(mc_rtc::MessagePackBuilder &out) const
Default triangle face color.
Definition: types.h:447
Definition: Polyhedron.h:100
ColoredPolyhedronImpl()
Definition: Polyhedron.h:119
GetColorT get_color_fn_
Definition: Polyhedron.h:144
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