NetDEM v1.0
Loading...
Searching...
No Matches
shape_poly_super_quadrics.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "shape.hpp"
4#include <iostream>
5
6namespace netdem {
7
30class PolySuperQuadrics : public Shape {
31public:
32 Vec2d axis_a{0.5, 0.5}, axis_b{0.5, 0.5}, axis_c{0.5, 0.5};
33 Vec2d order_a{1.0, 1.0}, order_b{1.0, 1.0}, order_c{1.0, 1.0};
34
35 // translating and rotating by pos_ref and quat_ref to convert to centroid and
36 // axies aligned shape
37 Vec3d pos_ref{0, 0, 0};
38 Vec4d quat_ref{1, 0, 0, 0}, quat_conj{1, 0, 0, 0};
39
44
62 PolySuperQuadrics(double am, double ap, double bm, double bp, double cm,
63 double cp, double nam, double nap, double nbm, double nbp,
64 double ncm, double ncp);
65
73 Shape *Clone() const override;
74
83 nlohmann::json PackJson() override;
84
93 void InitFromJson(nlohmann::json const &js) override;
94
101 void Init();
102
109 void UpdateSurfaceNodes() override;
110
117 void UpdateShapeProperties() override;
118
127 void SetSize(double d) override;
128
139 STLModel GetSTLModel(int num_nodes = 200) override;
140
153 Vec3d SupportPoint(Vec3d const &dir) override;
154
167 VecXT<Vec3d> SupportPoints(Vec3d const &dir) override;
168
181 double SignedDistance(Vec3d const &pos) const override;
182
195 Vec3d SurfacePoint(Vec3d const &pos) override;
196
208 Vec3d ParametrizationPoint(Vec3d const &dir);
209
210 // double CalculateRho(Vec3d const& dir);
211
218 void Print() override;
219};
220
221} // namespace netdem
A class representing a poly superquadric with three different axes and orders.
Definition shape_poly_super_quadrics.hpp:30
Vec2d axis_b
Definition shape_poly_super_quadrics.hpp:32
Vec2d axis_c
Definition shape_poly_super_quadrics.hpp:32
Vec4d quat_conj
Definition shape_poly_super_quadrics.hpp:38
Vec3d SupportPoint(Vec3d const &dir) override
Compute the support point of the PolySuperQuadrics object in a given direction.
Definition shape_poly_super_quadrics.cpp:274
void Init()
Initialize the PolySuperQuadrics object.
Definition shape_poly_super_quadrics.cpp:91
void UpdateShapeProperties() override
Update the shape properties of the PolySuperQuadrics object.
Definition shape_poly_super_quadrics.cpp:105
PolySuperQuadrics()
Default constructor.
Definition shape_poly_super_quadrics.cpp:13
void Print() override
Print information about the PolySuperQuadrics object.
Definition shape_poly_super_quadrics.cpp:480
Vec2d order_c
Definition shape_poly_super_quadrics.hpp:33
nlohmann::json PackJson() override
Pack the PolySuperQuadrics object into a JSON structure.
Definition shape_poly_super_quadrics.cpp:34
Vec2d axis_a
Definition shape_poly_super_quadrics.hpp:32
Shape * Clone() const override
Clone the PolySuperQuadrics object.
Definition shape_poly_super_quadrics.cpp:32
Vec3d pos_ref
Definition shape_poly_super_quadrics.hpp:37
void SetSize(double d) override
Set the size of the PolySuperQuadrics object.
Definition shape_poly_super_quadrics.cpp:72
double SignedDistance(Vec3d const &pos) const override
Compute the signed distance from a given position to the surface of the PolySuperQuadrics object.
Definition shape_poly_super_quadrics.cpp:385
STLModel GetSTLModel(int num_nodes=200) override
Generate an STL model for the PolySuperQuadrics object.
Definition shape_poly_super_quadrics.cpp:260
Vec2d order_b
Definition shape_poly_super_quadrics.hpp:33
VecXT< Vec3d > SupportPoints(Vec3d const &dir) override
Compute the support points of the PolySuperQuadrics object in a given direction.
Definition shape_poly_super_quadrics.cpp:379
void UpdateSurfaceNodes() override
Update surface nodes of the PolySuperQuadrics object.
Definition shape_poly_super_quadrics.cpp:98
Vec2d order_a
Definition shape_poly_super_quadrics.hpp:33
Vec3d SurfacePoint(Vec3d const &pos) override
Compute the surface point on the PolySuperQuadrics object closest to a given position.
Definition shape_poly_super_quadrics.cpp:413
void InitFromJson(nlohmann::json const &js) override
Initialize the PolySuperQuadrics object from a JSON structure.
Definition shape_poly_super_quadrics.cpp:48
Vec3d ParametrizationPoint(Vec3d const &dir)
Compute the parameterization point on the PolySuperQuadrics object in a given direction.
Definition shape_poly_super_quadrics.cpp:441
Vec4d quat_ref
Definition shape_poly_super_quadrics.hpp:38
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