NetDEM v1.0
Loading...
Searching...
No Matches
shape_poly_super_ellipsoid.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "shape.hpp"
4#include <iostream>
5
6namespace netdem {
7
27class PolySuperEllipsoid : public Shape {
28public:
29 Vec2d axis_a{0.5, 0.5}, axis_b{0.5, 0.5}, axis_c{0.5, 0.5};
30 double order_ab{1.0}, order_c{1.0};
31
32 // translating and rotating by pos_ref and quat_ref to convert to centroid and
33 // axies aligned shape
34 Vec3d pos_ref{0, 0, 0};
35 Vec4d quat_ref{1, 0, 0, 0}, quat_conj{1, 0, 0, 0};
36
41
55 PolySuperEllipsoid(double am, double ap, double bm, double bp, double cm,
56 double cp, double nab, double nc);
57
65 Shape *Clone() const override;
66
75 nlohmann::json PackJson() override;
76
85 void InitFromJson(nlohmann::json const &js) override;
86
93 void Init();
94
101 void UpdateSurfaceNodes() override;
102
109 void UpdateShapeProperties() override;
110
119 void SetSize(double d) override;
120
131 STLModel GetSTLModel(int num_nodes = 200) override;
132
145 Vec3d SupportPoint(Vec3d const &dir) override;
146
159 VecXT<Vec3d> SupportPoints(Vec3d const &dir) override;
160
173 double SignedDistance(Vec3d const &pos) const override;
174
187 Vec3d SurfacePoint(Vec3d const &pos) override;
188
200 Vec3d ParametrizationPoint(Vec3d const &dir);
201
202 // double CalculateRho(Vec3d const& dir);
203
210 void Print() override;
211};
212
213} // namespace netdem
A class representing a poly superellipsoid with two different orders and three different axes.
Definition shape_poly_super_ellipsoid.hpp:27
void Print() override
Print information about the PolySuperEllipsoid object.
Definition shape_poly_super_ellipsoid.cpp:421
double SignedDistance(Vec3d const &pos) const override
Compute the signed distance from a given position to the surface of the PolySuperEllipsoid object.
Definition shape_poly_super_ellipsoid.cpp:329
Vec2d axis_c
Definition shape_poly_super_ellipsoid.hpp:29
VecXT< Vec3d > SupportPoints(Vec3d const &dir) override
Compute the support points of the PolySuperEllipsoid object in a given direction.
Definition shape_poly_super_ellipsoid.cpp:323
double order_c
Definition shape_poly_super_ellipsoid.hpp:30
void UpdateSurfaceNodes() override
Update the surface nodes of the PolySuperEllipsoid object.
Definition shape_poly_super_ellipsoid.cpp:92
Shape * Clone() const override
Clone the PolySuperEllipsoid object.
Definition shape_poly_super_ellipsoid.cpp:31
Vec3d ParametrizationPoint(Vec3d const &dir)
Compute the parameterization point on the PolySuperEllipsoid object in a given direction.
Definition shape_poly_super_ellipsoid.cpp:382
Vec2d axis_a
Definition shape_poly_super_ellipsoid.hpp:29
Vec2d axis_b
Definition shape_poly_super_ellipsoid.hpp:29
Vec3d SupportPoint(Vec3d const &dir) override
Compute the support point of the PolySuperEllipsoid object in a given direction.
Definition shape_poly_super_ellipsoid.cpp:265
STLModel GetSTLModel(int num_nodes=200) override
Generate an STL model of the PolySuperEllipsoid object.
Definition shape_poly_super_ellipsoid.cpp:250
Vec3d SurfacePoint(Vec3d const &pos) override
Compute the surface point on the PolySuperEllipsoid object closest to a given position.
Definition shape_poly_super_ellipsoid.cpp:353
nlohmann::json PackJson() override
Pack the PolySuperEllipsoid object into a JSON structure.
Definition shape_poly_super_ellipsoid.cpp:35
void InitFromJson(nlohmann::json const &js) override
Initialize the PolySuperEllipsoid object from a JSON structure.
Definition shape_poly_super_ellipsoid.cpp:48
void UpdateShapeProperties() override
Update the shape properties of the PolySuperEllipsoid object.
Definition shape_poly_super_ellipsoid.cpp:99
double order_ab
Definition shape_poly_super_ellipsoid.hpp:30
void Init()
Initialize the PolySuperEllipsoid object.
Definition shape_poly_super_ellipsoid.cpp:85
void SetSize(double d) override
Set the size of the PolySuperEllipsoid object.
Definition shape_poly_super_ellipsoid.cpp:66
Vec3d pos_ref
Definition shape_poly_super_ellipsoid.hpp:34
Vec4d quat_conj
Definition shape_poly_super_ellipsoid.hpp:35
PolySuperEllipsoid()
Default constructor.
Definition shape_poly_super_ellipsoid.cpp:13
Vec4d quat_ref
Definition shape_poly_super_ellipsoid.hpp:35
This class represents different types of shapes and performs various calculations on them.
Definition shape.hpp:15
Definition bond_entry.hpp:7
std::array< double, 2 > Vec2d
Definition utils_macros.hpp:17
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
std::array< double, 4 > Vec4d
Definition utils_macros.hpp:19