PLaSK library
Loading...
Searching...
No Matches
transform_space_cylindric.hpp
Go to the documentation of this file.
1/*
2 * This file is part of PLaSK (https://plask.app) by Photonics Group at TUL
3 * Copyright (c) 2022 Lodz University of Technology
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, version 3.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 */
14#ifndef PLASK__TRANSFORM_SPACE_CYLINDRIC_H
15#define PLASK__TRANSFORM_SPACE_CYLINDRIC_H
16
17#include "transform.hpp"
18
19namespace plask {
20
28 unsigned rev_max_steps;
30
35 Revolution(shared_ptr<ChildType> child = shared_ptr<ChildType>(), bool auto_clip = false)
36 : GeometryObjectTransformSpace<3, 2>(child),
37 rev_max_steps(PLASK_GEOMETRY_MAX_STEPS),
38 rev_min_step_size(PLASK_GEOMETRY_MIN_STEP_SIZE) {
39 if (!auto_clip && childIsClipped())
40 throw Exception(
41 "Child of Revolution must have bounding box with positive tran. coordinates (when auto clipping is "
42 "off).");
43 }
44
45 static const char* NAME;
46
48 void setRevMaxSteps(unsigned long value) {
49 rev_max_steps = value;
51 }
52
54 void setRevMinStepSize(double value) {
55 rev_min_step_size = value;
57 }
58
59 std::string getTypeName() const override;
60
61 bool contains(const DVec& p) const override;
62
63 // TODO good but unused
64 // virtual bool intersects(const Box& area) const;
65
66 shared_ptr<Material> getMaterial(const DVec& p) const override;
67
68 Box fromChildCoords(const typename ChildType::Box& child_bbox) const override;
69
70 shared_ptr<GeometryObject> shallowCopy() const override;
71
72 using GeometryObjectTransformSpace<3, 2>::getPathsTo;
73
74 GeometryObject::Subtree getPathsAt(const DVec& point, bool all = false) const override;
75
76 void getPositionsToVec(const GeometryObject::Predicate& predicate,
77 std::vector<DVec>& dest,
78 const PathHints* path = 0) const override;
79
80 // virtual void extractToVec(const GeometryObject::Predicate& predicate, std::vector< shared_ptr<const
81 // GeometryObjectD<dim> > >& dest, const PathHints* = 0) const;
82
88 static Vec<2, double> childVec(const Vec<3, double>& v) { return rotateToLonTranAbs(v); }
89
90 /*
91 * Convert rectangle @p r to space of child.
92 * @param r cuboid in parent (this) space
93 * @return rectangle in child space
94 */
95 // static ChildBox childBox(const Box& r);
96
101 bool childIsClipped() const;
102
103 private:
109 static Box parentBox(const ChildBox& r);
110
111 void addPointsAlongToSet(std::set<double>& points,
112 Primitive<3>::Direction direction,
113 unsigned max_steps,
114 double min_step_size) const override;
115
116 void addLineSegmentsToSet(std::set<typename GeometryObjectD<3>::LineSegment>& segments,
117 unsigned max_steps,
118 double min_step_size) const override;
119};
120
121} // namespace plask
122
123#endif // PLASK__TRANSFORM_SPACE_CYLINDRIC_H