25 namespace Visualization {
39 bool triangulate =
false,
58 template <
typename volume_t>
62 size_t lseg = 72,
bool triangulate =
false,
66 auto bSurfaces = volume.boundarySurfaces();
67 for (
const auto& bs : bSurfaces) {
86 double thickness,
int arrows = 0,
double arrowLength = 0.,
87 double arrowWidth = 0.,
size_t lseg = 72,
90 auto direction =
Vector3D(end - start).normalized();
91 double hlength = 0.5 *
Vector3D(end - start).norm();
95 lrotation.col(0) = unitVectors.first;
96 lrotation.col(1) = unitVectors.second;
97 lrotation.col(2) = direction;
99 Vector3D lcenter = 0.5 * (start + end);
100 double alength = arrowLength * (2 * hlength);
104 }
else if (arrows != 0) {
105 hlength -= 0.5 * alength;
106 lcenter -=
Vector3D(arrows * 0.5 * alength * direction);
110 if (thickness > 0.) {
111 auto ltransform = std::make_shared<Transform3D>(Transform3D::Identity());
112 ltransform->prerotate(lrotation);
113 ltransform->pretranslate(lcenter);
115 auto lbounds = std::make_shared<CylinderBounds>(
thickness, hlength);
116 auto line = Surface::makeShared<CylinderSurface>(ltransform, lbounds);
126 double awith = thickness * arrowWidth;
127 double alpha = atan2(thickness * arrowWidth, alength);
128 auto plateBounds = std::make_shared<RadialBounds>(
thickness, awith);
131 auto aetransform = std::make_shared<Transform3D>(Transform3D::Identity());
132 aetransform->prerotate(lrotation);
133 aetransform->pretranslate(end);
135 auto coneBounds = std::make_shared<ConeBounds>(
alpha, -alength, 0.);
136 auto cone = Surface::makeShared<ConeSurface>(aetransform, coneBounds);
140 auto aptransform = std::make_shared<Transform3D>(Transform3D::Identity());
141 aptransform->prerotate(lrotation);
142 aptransform->pretranslate(
Vector3D(end - alength * direction));
144 auto plate = Surface::makeShared<DiscSurface>(aptransform, plateBounds);
148 if (arrows < 0 or arrows == 2) {
149 auto astransform = std::make_shared<Transform3D>(Transform3D::Identity());
150 astransform->prerotate(lrotation);
151 astransform->pretranslate(start);
154 auto coneBounds = std::make_shared<ConeBounds>(
alpha, 0., alength);
155 auto cone = Surface::makeShared<ConeSurface>(astransform, coneBounds);
159 auto aptransform = std::make_shared<Transform3D>(Transform3D::Identity());
160 aptransform->prerotate(lrotation);
161 aptransform->pretranslate(
Vector3D(start + alength * direction));
163 auto plate = Surface::makeShared<DiscSurface>(aptransform, plateBounds);
179 const Vector3D& end,
double thickness,
198 double thickness,
double arrowLength,
double arrowWidth,
size_t lseg = 72,
200 drawSegmentBase(helper, start, end, thickness, -1, arrowLength, arrowWidth,
216 double thickness,
double arrowLength,
double arrowWidth,
size_t lseg = 72,
218 drawSegmentBase(helper, start, end, thickness, 1, arrowLength, arrowWidth,
234 double thickness,
double arrowLength,
double arrowWidth,
size_t lseg = 72,
236 drawSegmentBase(helper, start, end, thickness, 2, arrowLength, arrowWidth,