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];
113 for (
unsigned j = 0; j <
steps; ++j) {
114 points.insert(-r - j * step);
115 points.insert(r + j * step);
118 points.insert(-
pts[
pts.size() - 1]);
119 points.insert(
pts[
pts.size() - 1]);
123void Revolution::addLineSegmentsToSet(std::set<
typename GeometryObjectD<3>::LineSegment>& segments,
125 double min_step_size)
const {
127 typedef typename GeometryObjectD<3>::LineSegment Segment;
130 std::set<typename GeometryObjectD<2>::LineSegment>
segments2;
132 double radius =
max(abs(this->
_child->getBoundingBox().left()), abs(this->
_child->getBoundingBox().right()));
136 for (
unsigned i = 1;
i <= (
steps + 1) / 2; ++
i) {
140 double x[2],
y[2], z[2];
141 for (
int j = 0; j < 2; ++
i) {
146 segments.insert(Segment(
DVec(-
x0, -
y0, z[j]),
DVec(-x[j], -y[j], z[j])));
147 segments.insert(Segment(
DVec(
x0, -
y0, z[j]),
DVec(x[j], -y[j], z[j])));
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])));
151 segments.insert(Segment(
DVec(-x[0], -y[0], z[0]),
DVec(-x[1], -y[1], z[1])));
152 segments.insert(Segment(
DVec(x[0], -y[0], z[0]),
DVec(x[1], -y[1], z[1])));
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])));
168 if (rev_max_steps) revolution->rev_max_steps = *rev_max_steps;
169 if (rev_min_step_size) revolution->rev_min_step_size = *rev_min_step_size;