PLaSK library
Loading...
Searching...
No Matches
circle.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_CIRCLE_H
15
#define PLASK__GEOMETRY_CIRCLE_H
16
21
#include "
leaf.hpp
"
22
23
namespace
plask
{
24
29
template
<
int
dim>
struct
PLASK_API
Circle
:
public
GeometryObjectLeaf
<dim> {
30
double
radius
;
31
33
typedef
typename
GeometryObjectLeaf<dim>::DVec
DVec
;
34
36
typedef
typename
GeometryObjectLeaf<dim>::Box
Box
;
37
38
static
const
char
*
NAME
;
39
40
std::string getTypeName()
const override
;
41
42
explicit
Circle
(
double
radius,
const
shared_ptr<Material>
& material =
shared_ptr<Material>
());
43
44
explicit
Circle
(
double
radius,
shared_ptr<MaterialsDB::MixedCompositionFactory>
materialTopBottom
)
45
:
GeometryObjectLeaf
<dim>(
materialTopBottom
), radius(radius) {
46
if
(radius < 0.) radius = 0.;
47
}
48
49
explicit
Circle
(
const
Circle
& src) :
GeometryObjectLeaf
<dim>(src), radius(src.radius) {}
50
51
shared_ptr<GeometryObject>
shallowCopy
()
const override
{
return
make_shared<Circle>
(*
this
); }
52
53
Box
getBoundingBox
()
const override
;
54
55
bool
contains(
const
DVec
& p)
const override
;
56
57
void
addPointsAlongToSet(std::set<double>& points,
58
Primitive<3>::Direction
direction,
59
unsigned
max_steps,
60
double
min_step_size)
const override
;
61
62
void
addLineSegmentsToSet
(std::set<
typename
GeometryObjectD<dim>::LineSegment
>& segments,
63
unsigned
max_steps,
64
double
min_step_size)
const override
;
65
66
void
writeXMLAttr(
XMLWriter::Element
&
dest_xml_object
,
const
AxisNames
& axes)
const override
;
67
72
void
setRadius
(
double
new_radius
) {
73
if
(
new_radius
< 0.)
new_radius
= 0.;
74
this->radius =
new_radius
;
75
this->fireChanged(
GeometryObject::Event::EVENT_RESIZE
);
76
}
77
};
78
79
template
<>
typename
Circle<2>::Box
Circle<2>::getBoundingBox
()
const
;
80
template
<>
typename
Circle<3>::Box
Circle<3>::getBoundingBox
()
const
;
81
82
template
<>
83
void
Circle<2>::addLineSegmentsToSet
(std::set<
typename
GeometryObjectD<2>::LineSegment
>& segments,
84
unsigned
max_steps,
85
double
min_step_size)
const
;
86
87
template
<>
88
void
Circle<3>::addLineSegmentsToSet
(std::set<
typename
GeometryObjectD<3>::LineSegment
>& segments,
89
unsigned
max_steps,
90
double
min_step_size)
const
;
91
92
PLASK_API_EXTERN_TEMPLATE_STRUCT
(
Circle<2>
)
93
PLASK_API_EXTERN_TEMPLATE_STRUCT
(
Circle<3>
)
94
95
}
// namespace plask
96
97
#endif
// PLASK__GEOMETRY_CIRCLE_H
plask
geometry
circle.hpp
Generated by
1.9.8