PLaSK library
Loading...
Searching...
No Matches
triangle.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_TRIANGLE_H
15#define PLASK__GEOMETRY_TRIANGLE_H
16
21#include "leaf.hpp"
22
23namespace plask {
24
31
33 typedef typename BaseClass::DVec DVec;
34
36 typedef typename BaseClass::Box Box;
37
38 static const char* NAME;
39
40 std::string getTypeName() const override;
41
47 explicit Triangle(const DVec& p0 = Primitive<2>::ZERO_VEC,
48 const DVec& p1 = Primitive<2>::ZERO_VEC,
49 const shared_ptr<Material>& material = shared_ptr<Material>());
50
56 explicit Triangle(const DVec& p0,
57 const DVec& p1,
59
60 // explicit Triangle(const DVec& p0, const DVec& p1, const std::unique_ptr<MaterialProvider>& materialProvider);
61
62 Box2D getBoundingBox() const override;
63
64 bool contains(const DVec& p) const override;
65
67
68 void addPointsAlongToSet(std::set<double>& points,
70 unsigned max_steps,
71 double min_step_size) const override;
72
73 void addLineSegmentsToSet(std::set<typename GeometryObjectD<2>::LineSegment>& segments,
74 unsigned max_steps,
75 double min_step_size) const override;
76
77 void writeXMLAttr(XMLWriter::Element& dest_xml_object, const AxisNames& axes) const override;
78
79 DVec p0, p1;
80
85 void setP0(const DVec& new_p0) {
86 p0 = new_p0;
87 this->fireChanged(GeometryObject::Event::EVENT_RESIZE);
88 }
89
94 void setP1(const DVec& new_p1) {
95 p1 = new_p1;
96 this->fireChanged(GeometryObject::Event::EVENT_RESIZE);
97 }
98};
99
100} // namespace plask
101
102#endif // PLASK__GEOMETRY_TRIANGLE_H