15#include "../manager.hpp"
18#define PLASK_REVOLUTION_NAME "revolution"
50 std::vector<GeometryObjectTransformSpace::DVec>&
dest,
52 if (predicate(*
this)) {
59 dest.emplace_back(0., 0.,
v.vert()
64 return this->
hasChild() && (this->
_child->getBoundingBox().lower.tran() < 0);
84Box3D Revolution::parentBox(
const ChildBox& r) {
85 double tran = std::max(r.upper.tran(), 0.0);
86 return Box3D(
vec(-tran, -tran, r.lower.vert()),
vec(tran, tran, r.upper.vert()));
89void Revolution::addPointsAlongToSet(std::set<double>& points,
90 Primitive<3>::Direction direction,
92 double min_step_size)
const {
96 if (direction == Primitive<3>::DIRECTION_VERT) {
103 std::vector<double>
pts;
107 for (
size_t i = 1;
i <
pts.size(); ++
i) {
108 double r =
pts[
i - 1];
115 for (
unsigned j = 0; j <
steps; ++j) {
116 points.insert(-r - j * step);
117 points.insert(r + j * step);
120 points.insert(-
pts[
pts.size() - 1]);
121 points.insert(
pts[
pts.size() - 1]);
125void Revolution::addLineSegmentsToSet(std::set<
typename GeometryObjectD<3>::LineSegment>& segments,
127 double min_step_size)
const {
129 typedef typename GeometryObjectD<3>::LineSegment Segment;
132 std::set<typename GeometryObjectD<2>::LineSegment>
segments2;
134 double radius =
max(abs(this->
_child->getBoundingBox().left()), abs(this->
_child->getBoundingBox().right()));
138 for (
unsigned i = 1;
i <= (
steps + 1) / 2; ++
i) {
142 double x[2],
y[2], z[2];
143 for (
int j = 0; j < 2; ++
i) {
148 segments.insert(Segment(
DVec(-
x0, -
y0, z[j]),
DVec(-x[j], -y[j], z[j])));
149 segments.insert(Segment(
DVec(
x0, -
y0, z[j]),
DVec(x[j], -y[j], z[j])));
150 segments.insert(Segment(
DVec(-
x0,
y0, z[j]),
DVec(-x[j], y[j], z[j])));
151 segments.insert(Segment(
DVec(
x0,
y0, z[j]),
DVec(x[j], y[j], z[j])));
153 segments.insert(Segment(
DVec(-x[0], -y[0], z[0]),
DVec(-x[1], -y[1], z[1])));
154 segments.insert(Segment(
DVec(x[0], -y[0], z[0]),
DVec(x[1], -y[1], z[1])));
155 segments.insert(Segment(
DVec(-x[0], y[0], z[0]),
DVec(-x[1], y[1], z[1])));
156 segments.insert(Segment(
DVec(x[0], y[0], z[0]),
DVec(x[1], y[1], z[1])));
170 if (rev_max_steps) revolution->rev_max_steps = *rev_max_steps;
171 if (rev_min_step_size) revolution->rev_min_step_size = *rev_min_step_size;