PLaSK library
Loading...
Searching...
No Matches
ellipse.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_ELLIPSE_H
15
#define PLASK__GEOMETRY_ELLIPSE_H
16
21
#include "
leaf.hpp
"
22
23
namespace
plask
{
24
29
struct
PLASK_API
Ellipse
:
public
GeometryObjectLeaf
<2> {
30
double
radius0
;
31
double
radius1
;
32
34
typedef
typename
GeometryObjectLeaf<2>::DVec
DVec
;
35
37
typedef
typename
GeometryObjectLeaf<2>::Box
Box
;
38
39
static
const
char
*
NAME
;
40
41
std::string getTypeName()
const override
;
42
43
explicit
Ellipse
(
double
rx
,
double
ry
,
const
shared_ptr<Material>
& material =
shared_ptr<Material>
());
44
45
explicit
Ellipse
(
double
rx
,
double
ry
,
shared_ptr<MaterialsDB::MixedCompositionFactory>
materialTopBottom
);
46
47
explicit
Ellipse
(
const
Ellipse
& src) :
GeometryObjectLeaf
(src), radius0(src.radius0), radius1(src.radius1) {}
48
49
shared_ptr<GeometryObject>
shallowCopy
()
const override
{
return
make_shared<Ellipse>
(*
this
); }
50
51
Box getBoundingBox()
const override
;
52
53
bool
contains(
const
DVec& p)
const override
;
54
55
void
addPointsAlongToSet(std::set<double>& points,
56
Primitive<3>::Direction
direction,
57
unsigned
max_steps,
58
double
min_step_size)
const override
;
59
60
void
addLineSegmentsToSet(std::set<typename GeometryObjectD::LineSegment>& segments,
61
unsigned
max_steps,
62
double
min_step_size)
const override
;
63
64
void
writeXMLAttr(
XMLWriter::Element
&
dest_xml_object
,
const
AxisNames
& axes)
const override
;
65
70
std::pair<double, double>
getRadii
()
const
{
return
std::make_pair(radius0, radius1); }
71
77
void
setRadii
(
double
rx
,
double
ry
) {
78
this->radius0 = std::max(
rx
, 0.);
79
this->radius1 = std::max(
ry
, 0.);
80
this->fireChanged(
GeometryObject::Event::EVENT_RESIZE
);
81
}
82
87
void
setRadius0
(
double
new_radius
) {
88
if
(
new_radius
< 0.)
new_radius
= 0.;
89
this->radius0 =
new_radius
;
90
this->fireChanged(
GeometryObject::Event::EVENT_RESIZE
);
91
}
92
97
void
setRadius1
(
double
new_radius
) {
98
if
(
new_radius
< 0.)
new_radius
= 0.;
99
this->radius1 =
new_radius
;
100
this->fireChanged(
GeometryObject::Event::EVENT_RESIZE
);
101
}
102
};
103
104
}
// namespace plask
105
106
#endif
// PLASK__GEOMETRY_ELLIPSE_H
plask
geometry
ellipse.hpp
Generated by
1.9.8