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)
160 template<
typename GetTrianglesT>
167 template<
typename GetVerticesOrTrianglesT,
typename GetTrianglesOrColorsT>
169 GetVerticesOrTrianglesT get_vertices_or_triangles_fn,
170 GetTrianglesOrColorsT get_triangles_or_colors_fn)
176 get_triangles_or_colors_fn);
181 name, {}, get_vertices_or_triangles_fn, get_triangles_or_colors_fn);
186 template<
typename GetVerticesOrTrianglesT,
typename GetTrianglesOrColorsT>
189 GetVerticesOrTrianglesT get_vertices_or_triangles_fn,
190 GetTrianglesOrColorsT get_triangles_or_colors_fn)
194 auto poly =
Polyhedron(name, config, get_vertices_or_triangles_fn);
196 get_triangles_or_colors_fn);
201 name, config, get_vertices_or_triangles_fn, get_triangles_or_colors_fn);
206 template<
typename GetTrianglesT,
typename GetColorT>
209 GetTrianglesT get_triangles_fn,
210 GetColorT get_color_fn)
212 auto poly =
Polyhedron(name, config, get_triangles_fn);
217 template<
typename GetVerticesT,
typename GetTrianglesT,
typename GetColorT>
219 GetVerticesT get_vertices_fn,
220 GetTrianglesT get_triangles_fn,
221 GetColorT get_color_fn)
223 auto poly =
Polyhedron(name, get_vertices_fn, get_triangles_fn);
228 template<
typename GetVerticesT,
typename GetTrianglesT,
typename GetColorT>
231 GetVerticesT get_vertices_fn,
232 GetTrianglesT get_triangles_fn,
233 GetColorT get_color_fn)
235 auto poly =
Polyhedron(name, config, get_vertices_fn, get_triangles_fn);
auto write(T &value)
Definition: traits.h:230
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:207
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