ESPResSo
Extensible Simulation Package for Research on Soft Matter Systems
Loading...
Searching...
No Matches
shapes/include/shapes/HollowConicalFrustum.hpp
Go to the documentation of this file.
1/*
2 * Copyright (C) 2017-2022 The ESPResSo project
3 *
4 * This file is part of ESPResSo.
5 *
6 * ESPResSo is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * ESPResSo is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#ifndef SHAPES_CONICAL_FRUSTUM_HPP
21#define SHAPES_CONICAL_FRUSTUM_HPP
22
23#include "Shape.hpp"
25#include <utils/Vector.hpp>
26
27#include <list>
28#include <memory>
29#include <utility>
30
31namespace Shapes {
32
33/**
34 * <pre>
35 * -------->r1
36 * ^ a \
37 * | x \
38 * | i \
39 * | s \ *pos
40 * * center \
41 * | \
42 * | \
43 * | \
44 * | \
45 * ----------------->r2
46 * </pre>
47 * @brief Conical frustum shape with rounded corners and finite thickness.
48 *
49 * \image html conical_frustum.png width=800px
50 */
52public:
54 double const r1, double const r2, double const length,
55 double const thickness, int const direction, double const central_angle,
56 std::shared_ptr<Utils::CylindricalTransformationParameters>
57 cyl_transform_params)
58 : m_r1(r1), m_r2(r2), m_length(length), m_thickness(thickness),
59 m_direction(direction), m_central_angle(central_angle),
60 m_cyl_transform_params(std::move(cyl_transform_params)) {}
61
62 void set_r1(double const radius) { m_r1 = radius; }
63 void set_r2(double const radius) { m_r2 = radius; }
64 void set_length(double const length) { m_length = length; }
65 void set_thickness(double const thickness) { m_thickness = thickness; }
66 void set_direction(int const dir) { m_direction = dir; }
67 void set_central_angle(double const central_angle) {
68 m_central_angle = central_angle;
69 }
70
71 /// Get radius 1 perpendicular to axis.
72 double radius1() const { return m_r1; }
73 /// Get radius 2 perpendicular to axis.
74 double radius2() const { return m_r2; }
75 /// Get length of the frustum (without thickness).
76 double length() const { return m_length; }
77 /// Get thickness of the frustum.
78 double thickness() const { return m_thickness; }
79 /// Get direction
80 int direction() const { return m_direction; }
81 /// Get central angle
82 double central_angle() const { return m_central_angle; }
83
84 /**
85 * @brief Calculate the distance vector and its norm between a given position
86 * and the cone.
87 * @param[in] pos Position for which distance to the cone is calculated.
88 * @param[out] dist Distance between cone and \p pos.
89 * @param[out] vec Distance vector (\p dist = || \p vec ||).
90 */
91 void calculate_dist(const Utils::Vector3d &pos, double &dist,
92 Utils::Vector3d &vec) const override;
93
94private:
95 double m_r1;
96 double m_r2;
97 double m_length;
98 double m_thickness;
99 int m_direction;
100 double m_central_angle;
101 std::shared_ptr<Utils::CylindricalTransformationParameters>
102 m_cyl_transform_params;
103};
104} // namespace Shapes
105
106#endif
Vector implementation and trait types for boost qvm interoperability.
Conical frustum shape with rounded corners and finite thickness.
void calculate_dist(const Utils::Vector3d &pos, double &dist, Utils::Vector3d &vec) const override
Calculate the distance vector and its norm between a given position and the cone.
double radius1() const
Get radius 1 perpendicular to axis.
double radius2() const
Get radius 2 perpendicular to axis.
double length() const
Get length of the frustum (without thickness).
double thickness() const
Get thickness of the frustum.
HollowConicalFrustum(double const r1, double const r2, double const length, double const thickness, int const direction, double const central_angle, std::shared_ptr< Utils::CylindricalTransformationParameters > cyl_transform_params)