NetDEM v1.0
Loading...
Searching...
No Matches
shape_sphere.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "shape.hpp"
4#include <iostream>
5
6namespace netdem {
7
17class Sphere : public Shape {
18public:
22 Sphere();
23
29 Sphere(double d);
30
38 Shape *Clone() const override;
39
48 nlohmann::json PackJson() override;
49
58 void InitFromJson(nlohmann::json const &js) override;
59
66 void Init();
67
74 void UpdateSurfaceNodes() override;
75
82 void UpdateShapeProperties() override;
83
94 STLModel GetSTLModel(int num_nodes = 200) override;
95
106 Vec3d SupportPoint(Vec3d const &dir) override;
107
120 VecXT<Vec3d> SupportPoints(Vec3d const &dir) override;
121
132 double SignedDistance(Vec3d const &pos) const override;
133
145 Vec3d SurfacePoint(Vec3d const &pos) override;
146
153 void Print() override;
154};
155
156} // namespace netdem
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
A class representing a sphere.
Definition shape_sphere.hpp:17
void UpdateSurfaceNodes() override
Update the surface nodes of the Sphere object.
Definition shape_sphere.cpp:48
void UpdateShapeProperties() override
Update the shape properties of the Sphere object.
Definition shape_sphere.cpp:70
Vec3d SupportPoint(Vec3d const &dir) override
Compute the support point of the Sphere object in a given direction.
Definition shape_sphere.cpp:113
STLModel GetSTLModel(int num_nodes=200) override
Generate an STL model for the Sphere object.
Definition shape_sphere.cpp:97
void InitFromJson(nlohmann::json const &js) override
Initialize the Sphere object from a JSON structure.
Definition shape_sphere.cpp:33
Shape * Clone() const override
Clone the Sphere object.
Definition shape_sphere.cpp:29
double SignedDistance(Vec3d const &pos) const override
Compute the signed distance between a point and the Sphere object.
Definition shape_sphere.cpp:121
Sphere()
Default constructor.
Definition shape_sphere.cpp:11
void Init()
Initialize the Sphere object.
Definition shape_sphere.cpp:41
Vec3d SurfacePoint(Vec3d const &pos) override
Compute the surface point of the Sphere object closest to a given point.
Definition shape_sphere.cpp:125
VecXT< Vec3d > SupportPoints(Vec3d const &dir) override
Compute the support points of the Sphere object in a given direction.
Definition shape_sphere.cpp:115
nlohmann::json PackJson() override
Pack the Sphere object into a JSON structure.
Definition shape_sphere.cpp:31
void Print() override
Print information about the Sphere object.
Definition shape_sphere.cpp:133
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