NetDEM v1.0
Loading...
Searching...
No Matches
shape_cylinder.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "shape.hpp"
4#include <iostream>
5
6namespace netdem {
7
15class Cylinder : public Shape {
16public:
20 double radius{0.5};
21
25 double height{1.0};
26
30 Cylinder();
31
40 Cylinder(double r, double h);
41
49 Shape *Clone() const override;
50
59 nlohmann::json PackJson() override;
60
69 void InitFromJson(nlohmann::json const &js) override;
70
77 void Init();
78
87 void SetSize(double d) override;
88
95 void UpdateSurfaceNodes() override;
96
103 void UpdateShapeProperties() override;
104
115 STLModel GetSTLModel(int num_nodes = 200) override;
116
129 Vec3d SupportPoint(Vec3d const &dir) override;
130
143 VecXT<Vec3d> SupportPoints(Vec3d const &dir) override;
144
157 double SignedDistance(Vec3d const &pos) const override;
158
172 Vec3d SurfacePoint(Vec3d const &pos) override;
173
185 double CalculateRho(Vec3d const &dir);
186
193 void Print() override;
194};
195
196} // namespace netdem
A class for representing a cylinder shape.
Definition shape_cylinder.hpp:15
Cylinder()
Default constructor.
Definition shape_cylinder.cpp:13
void UpdateShapeProperties() override
Update the shape properties of the Cylinder object.
Definition shape_cylinder.cpp:84
double radius
The radius of the cylinder.
Definition shape_cylinder.hpp:20
double height
The height of the cylinder.
Definition shape_cylinder.hpp:25
void InitFromJson(nlohmann::json const &js) override
Initialize the Cylinder object from a JSON structure.
Definition shape_cylinder.cpp:38
STLModel GetSTLModel(int num_nodes=200) override
Generate an STL model of the Cylinder object.
Definition shape_cylinder.cpp:114
void UpdateSurfaceNodes() override
Update the surface nodes of the Cylinder object.
Definition shape_cylinder.cpp:62
Vec3d SupportPoint(Vec3d const &dir) override
Compute the support point in a given direction for the Cylinder object.
Definition shape_cylinder.cpp:169
void Init()
Initialize the Cylinder object.
Definition shape_cylinder.cpp:55
void SetSize(double d) override
Set the size of the Cylinder object.
Definition shape_cylinder.cpp:47
double SignedDistance(Vec3d const &pos) const override
Compute the signed distance from a given position to the surface of the Cylinder object.
Definition shape_cylinder.cpp:230
VecXT< Vec3d > SupportPoints(Vec3d const &dir) override
Compute the support points in a given direction for the Cylinder object.
Definition shape_cylinder.cpp:184
double CalculateRho(Vec3d const &dir)
Compute the distance from the center of the Cylinder object to a plane perpendicular to its axis in a...
Definition shape_cylinder.cpp:294
Shape * Clone() const override
Clone the Cylinder object.
Definition shape_cylinder.cpp:27
void Print() override
Print information about the Cylinder object.
Definition shape_cylinder.cpp:303
nlohmann::json PackJson() override
Pack the Cylinder object into a JSON structure.
Definition shape_cylinder.cpp:29
Vec3d SurfacePoint(Vec3d const &pos) override
Compute the surface point closest to a given position on the Cylinder object.
Definition shape_cylinder.cpp:253
Class for working with STL models.
Definition stl_model.hpp:17
This class represents different types of shapes and performs various calculations on them.
Definition shape.hpp:15
Definition bond_entry.hpp:7
std::vector< T > VecXT
Definition utils_macros.hpp:31
pos
Definition json_serilization.hpp:19
std::array< double, 3 > Vec3d
Definition utils_macros.hpp:18