21 #include "Sample/HardParticle/HardParticles.h"
27 double thickness(0.0);
36 std::unique_ptr<GUI::RealSpace::Layer>
43 auto ztop =
static_cast<double>(origin.z());
44 double zbottom =
static_cast<double>(origin.z()) - thickness;
46 std::unique_ptr<GUI::RealSpace::Layer> result =
55 result->color = color;
60 std::unique_ptr<GUI::RealSpace::Particles::Particle>
63 if (
const auto* ff_Pyramid2 =
dynamic_cast<const Pyramid2*
>(ff)) {
64 double length = ff_Pyramid2->length();
65 double width = ff_Pyramid2->width();
66 double height = ff_Pyramid2->height();
67 double alpha = ff_Pyramid2->alpha();
68 return std::make_unique<GUI::RealSpace::Particles::Pyramid2>(length, width, height, alpha);
70 if (
const auto* ff_BarGauss =
dynamic_cast<const BarGauss*
>(ff)) {
71 double length = ff_BarGauss->length();
72 double width = ff_BarGauss->width();
73 double height = ff_BarGauss->height();
74 return std::make_unique<GUI::RealSpace::Particles::BarGauss>(length, width, height);
76 if (
const auto* ff_BarLorentz =
dynamic_cast<const BarLorentz*
>(ff)) {
77 double length = ff_BarLorentz->length();
78 double width = ff_BarLorentz->width();
79 double height = ff_BarLorentz->height();
80 return std::make_unique<GUI::RealSpace::Particles::BarLorentz>(length, width, height);
82 if (
const auto* ff_Box =
dynamic_cast<const Box*
>(ff)) {
83 double length = ff_Box->length();
84 double width = ff_Box->width();
85 double height = ff_Box->height();
86 return std::make_unique<GUI::RealSpace::Particles::Box>(length, width, height);
88 if (
const auto* ff_Cone =
dynamic_cast<const Cone*
>(ff)) {
89 double radius = ff_Cone->radius();
90 double height = ff_Cone->height();
91 double alpha = ff_Cone->alpha();
92 return std::make_unique<GUI::RealSpace::Particles::Cone>(radius, height, alpha);
94 if (
const auto* ff_Pyramid6 =
dynamic_cast<const Pyramid6*
>(ff)) {
95 double baseedge = ff_Pyramid6->baseEdge();
96 double height = ff_Pyramid6->height();
97 double alpha = ff_Pyramid6->alpha();
98 return std::make_unique<GUI::RealSpace::Particles::Pyramid6>(baseedge, height, alpha);
100 if (
const auto* ff_Bipyramid4 =
dynamic_cast<const Bipyramid4*
>(ff)) {
101 double length = ff_Bipyramid4->length();
102 double height = ff_Bipyramid4->height();
103 double height_ratio = ff_Bipyramid4->heightRatio();
104 double alpha = ff_Bipyramid4->alpha();
105 return std::make_unique<GUI::RealSpace::Particles::Bipyramid4>(length, height, height_ratio,
108 if (
const auto* ff_Cylinder =
dynamic_cast<const Cylinder*
>(ff)) {
109 double radius = ff_Cylinder->radius();
110 double height = ff_Cylinder->height();
111 return std::make_unique<GUI::RealSpace::Particles::Cylinder>(radius, height);
113 if (
const auto* ff_Dodecahedron =
dynamic_cast<const Dodecahedron*
>(ff)) {
114 double edge = ff_Dodecahedron->edge();
115 return std::make_unique<GUI::RealSpace::Particles::Dodecahedron>(edge);
117 if (
const auto* ff_EllipsoidalCylinder =
dynamic_cast<const EllipsoidalCylinder*
>(ff)) {
118 double radius_x = ff_EllipsoidalCylinder->radiusX();
119 double radius_y = ff_EllipsoidalCylinder->radiusY();
120 double height = ff_EllipsoidalCylinder->height();
121 return std::make_unique<GUI::RealSpace::Particles::EllipsoidalCylinder>(radius_x, radius_y,
124 if (
const auto* ff_Sphere =
dynamic_cast<const Sphere*
>(ff)) {
125 double radius = ff_Sphere->radius();
126 return std::make_unique<GUI::RealSpace::Particles::Sphere>(radius);
128 if (
const auto* ff_Spheroid =
dynamic_cast<const Spheroid*
>(ff)) {
129 double radius = ff_Spheroid->radius();
130 double height = ff_Spheroid->height();
131 return std::make_unique<GUI::RealSpace::Particles::Spheroid>(radius, height);
133 if (
const auto* ff_HemiEllipsoid =
dynamic_cast<const HemiEllipsoid*
>(ff)) {
134 double radius_x = ff_HemiEllipsoid->radiusX();
135 double radius_y = ff_HemiEllipsoid->radiusY();
136 double height = ff_HemiEllipsoid->height();
137 return std::make_unique<GUI::RealSpace::Particles::HemiEllipsoid>(radius_x, radius_y,
140 if (
const auto* ff_Icosahedron =
dynamic_cast<const Icosahedron*
>(ff)) {
141 double edge = ff_Icosahedron->edge();
142 return std::make_unique<GUI::RealSpace::Particles::Icosahedron>(edge);
144 if (
const auto* ff_Prism3 =
dynamic_cast<const Prism3*
>(ff)) {
145 double baseedge = ff_Prism3->baseEdge();
146 double height = ff_Prism3->height();
147 return std::make_unique<GUI::RealSpace::Particles::Prism3>(baseedge, height);
149 if (
const auto* ff_Prism6 =
dynamic_cast<const Prism6*
>(ff)) {
150 double baseedge = ff_Prism6->baseEdge();
151 double height = ff_Prism6->height();
152 return std::make_unique<GUI::RealSpace::Particles::Prism6>(baseedge, height);
154 if (
const auto* ff_Pyramid4 =
dynamic_cast<const Pyramid4*
>(ff)) {
155 double baseedge = ff_Pyramid4->baseEdge();
156 double height = ff_Pyramid4->height();
157 double alpha = ff_Pyramid4->alpha();
158 return std::make_unique<GUI::RealSpace::Particles::Pyramid4>(baseedge, height, alpha);
160 if (
const auto* ff_CosineRippleBox =
dynamic_cast<const CosineRippleBox*
>(ff)) {
161 double length = ff_CosineRippleBox->length();
162 double width = ff_CosineRippleBox->width();
163 double height = ff_CosineRippleBox->height();
164 return std::make_unique<GUI::RealSpace::Particles::CosineRippleBox>(length, width, height);
166 if (
const auto* ff_CosineRippleGauss =
dynamic_cast<const CosineRippleGauss*
>(ff)) {
167 double length = ff_CosineRippleGauss->length();
168 double width = ff_CosineRippleGauss->width();
169 double height = ff_CosineRippleGauss->height();
170 return std::make_unique<GUI::RealSpace::Particles::CosineRippleGauss>(length, width,
173 if (
const auto* ff_CosineRippleLorentz =
dynamic_cast<const CosineRippleLorentz*
>(ff)) {
174 double length = ff_CosineRippleLorentz->length();
175 double width = ff_CosineRippleLorentz->width();
176 double height = ff_CosineRippleLorentz->height();
177 return std::make_unique<GUI::RealSpace::Particles::CosineRippleLorentz>(length, width,
180 if (
const auto* ff_SawtoothRippleBox =
dynamic_cast<const SawtoothRippleBox*
>(ff)) {
181 double length = ff_SawtoothRippleBox->length();
182 double width = ff_SawtoothRippleBox->width();
183 double height = ff_SawtoothRippleBox->height();
184 return std::make_unique<GUI::RealSpace::Particles::SawtoothRippleBox>(length, width,
187 if (
const auto* ff_SawtoothRippleGauss =
dynamic_cast<const SawtoothRippleGauss*
>(ff)) {
188 double length = ff_SawtoothRippleGauss->length();
189 double width = ff_SawtoothRippleGauss->width();
190 double height = ff_SawtoothRippleGauss->height();
191 return std::make_unique<GUI::RealSpace::Particles::SawtoothRippleGauss>(length, width,
194 if (
const auto* ff_SawtoothRippleLorentz =
dynamic_cast<const SawtoothRippleLorentz*
>(ff)) {
195 double length = ff_SawtoothRippleLorentz->length();
196 double width = ff_SawtoothRippleLorentz->width();
197 double height = ff_SawtoothRippleLorentz->height();
198 return std::make_unique<GUI::RealSpace::Particles::SawtoothRippleLorentz>(length, width,
201 if (
const auto* ff_Pyramid3 =
dynamic_cast<const Pyramid3*
>(ff)) {
202 double baseedge = ff_Pyramid3->baseEdge();
203 double height = ff_Pyramid3->height();
204 double alpha = ff_Pyramid3->alpha();
205 return std::make_unique<GUI::RealSpace::Particles::Pyramid3>(baseedge, height, alpha);
207 if (
const auto* ff_TruncatedCube =
dynamic_cast<const TruncatedCube*
>(ff)) {
208 double length = ff_TruncatedCube->length();
209 double removed_length = ff_TruncatedCube->removedLength();
210 return std::make_unique<GUI::RealSpace::Particles::TruncatedCube>(length, removed_length);
212 if (
const auto* ff_TruncatedSphere =
dynamic_cast<const TruncatedSphere*
>(ff)) {
213 double radius = ff_TruncatedSphere->radius();
214 double height = ff_TruncatedSphere->height();
215 double deltaH = ff_TruncatedSphere->removedTop();
216 return std::make_unique<GUI::RealSpace::Particles::TruncatedSphere>(radius, height, deltaH);
218 if (
const auto* ff_TruncatedSpheroid =
dynamic_cast<const TruncatedSpheroid*
>(ff)) {
219 double radius = ff_TruncatedSpheroid->radius();
220 double height = ff_TruncatedSpheroid->height();
221 double hfc = ff_TruncatedSpheroid->heightFlattening();
222 double deltaH = ff_TruncatedSpheroid->removedTop();
223 return std::make_unique<GUI::RealSpace::Particles::TruncatedSpheroid>(radius, height, hfc,
226 if (
const auto* ff_CantellatedCube =
dynamic_cast<const CantellatedCube*
>(ff)) {
227 double length = ff_CantellatedCube->length();
228 double removed_length = ff_CantellatedCube->removedLength();
229 return std::make_unique<GUI::RealSpace::Particles::CantellatedCube>(length, removed_length);
231 if (
const auto* ff_HorizontalCylinder =
dynamic_cast<const HorizontalCylinder*
>(ff)) {
232 double radius = ff_HorizontalCylinder->radius();
233 double length = ff_HorizontalCylinder->length();
234 double slice_bottom = ff_HorizontalCylinder->slice_bottom();
235 double slice_top = ff_HorizontalCylinder->slice_top();
236 return std::make_unique<GUI::RealSpace::Particles::HorizontalCylinder>(
237 radius, length, slice_bottom, slice_top);
239 if (
const auto* ff_PlatonicOctahedron =
dynamic_cast<const PlatonicOctahedron*
>(ff)) {
240 double edge = ff_PlatonicOctahedron->edge();
241 return std::make_unique<GUI::RealSpace::Particles::PlatonicOctahedron>(edge);
243 if (
const auto* ff_PlatonicTetrahedron =
dynamic_cast<const PlatonicTetrahedron*
>(ff)) {
244 double edge = ff_PlatonicTetrahedron->edge();
245 return std::make_unique<GUI::RealSpace::Particles::PlatonicTetrahedron>(edge);
Defines class MultiLayerItem.
Defines class ParticleItem.
Defines class RealSpaceCanvas.
QColor materialColor() const
bool isBottomLayer() const
DoubleDescriptor thickness() const
Size and thickness information of layers.
double topOrBottomLayerThickness
double layerMinimumThickness