PLaSK library
Loading...
Searching...
No Matches
prism.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__GEOMETRY_PRISM_H
15#define PLASK__GEOMETRY_PRISM_H
16
21#include "leaf.hpp"
22
23namespace plask {
24
31
33 typedef typename BaseClass::DVec DVec;
34
36 typedef Vec<2> Vec2;
37
39 typedef typename BaseClass::Box Box;
40
41 static const char* NAME;
42
43 std::string getTypeName() const override;
44
50 explicit Prism(const Vec2& p0 = Primitive<2>::ZERO_VEC,
51 const Vec2& p1 = Primitive<2>::ZERO_VEC,
52 double height = 0.,
53 const shared_ptr<Material>& material = shared_ptr<Material>());
54
60 explicit Prism(const Vec2& p0,
61 const Vec2& p1,
62 double height,
64
65 // explicit Prism(const DVec& p0, const Vec2& p1, double height,
66 // const std::unique_ptr<MaterialProvider>& materialProvider);
67
68 Box3D getBoundingBox() const override;
69
70 bool contains(const DVec& p) const override;
71
72 shared_ptr<GeometryObject> shallowCopy() const override { return make_shared<Prism>(*this); }
73
74 void addPointsAlongToSet(std::set<double>& points,
76 unsigned max_steps,
77 double min_step_size) const override;
78
79 void addLineSegmentsToSet(std::set<typename GeometryObjectD<3>::LineSegment>& segments,
80 unsigned max_steps,
81 double min_step_size) const override;
82
83 void writeXMLAttr(XMLWriter::Element& dest_xml_object, const AxisNames& axes) const override;
84
86 Vec2 p0, p1;
87
89 double height;
90
95 void setP0(const Vec2& new_p0) {
96 p0 = new_p0;
97 this->fireChanged(GeometryObject::Event::EVENT_RESIZE);
98 }
99
104 void setP1(const Vec2& new_p1) {
105 p1 = new_p1;
106 this->fireChanged(GeometryObject::Event::EVENT_RESIZE);
107 }
108
113 void setHeight(double new_height) {
114 height = new_height;
115 this->fireChanged(GeometryObject::Event::EVENT_RESIZE);
116 }
117};
118
119} // namespace plask
120
121#endif // PLASK__GEOMETRY_PRISM_H