NetDEM v1.0
Loading...
Searching...
No Matches
shape_plane.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "shape.hpp"
4#include <cmath>
5#include <iostream>
6
7namespace netdem {
8
22class Plane : public Shape {
23public:
24 Vec3d center{0, 0, 0}, dir_n{0, 0, 1};
25
31 double extent{5};
32
36 Plane();
37
44 Plane(Vec3d const &c, Vec3d const &n);
45
57 Plane(double c_x, double c_y, double c_z, double n_x, double n_y, double n_z);
58
65 void UpdateSurfaceNodes() override;
66
73 void UpdateShapeProperties() override;
74
82 Shape *Clone() const override;
83
92 nlohmann::json PackJson() override;
93
102 void InitFromJson(nlohmann::json const &js) override;
103
110 void Init();
111
119 void SetExtent(double e);
120
130 void SetCenter(double c_x, double c_y, double c_z);
131
141 void SetNormal(double n_x, double n_y, double n_z);
142
154 std::tuple<Vec3d, Vec3d> GetBoundAABB(Vec3d const &pos,
155 Vec4d const &quat) const override;
156
167 STLModel GetSTLModel(int num_nodes = 400) override;
168
179 Vec3d SupportPoint(Vec3d const &dir) override;
180
192 VecXT<Vec3d> SupportPoints(Vec3d const &dir) override;
193
205 double SignedDistance(Vec3d const &pos) const override;
206
219 Vec3d SurfacePoint(Vec3d const &pos) override;
220
227 void Print() override;
228};
229
230} // namespace netdem
A class for representing a plane with a center point and normal vector.
Definition shape_plane.hpp:22
void Init()
Initialize the Plane object.
Definition shape_plane.cpp:34
void UpdateShapeProperties() override
Update the shape properties of the Plane object.
Definition shape_plane.cpp:83
void InitFromJson(nlohmann::json const &js) override
Initialize the Plane object from a JSON structure.
Definition shape_plane.cpp:107
void SetNormal(double n_x, double n_y, double n_z)
Set the normal vector of the Plane object.
Definition shape_plane.cpp:133
Vec3d SupportPoint(Vec3d const &dir) override
Compute the support point of the Plane object in a given direction.
Definition shape_plane.cpp:203
void SetExtent(double e)
Set the extent of the Plane object.
Definition shape_plane.cpp:119
Vec3d dir_n
Definition shape_plane.hpp:24
nlohmann::json PackJson() override
Pack the Plane object into a JSON structure.
Definition shape_plane.cpp:97
Vec3d center
Definition shape_plane.hpp:24
void Print() override
Print information about the Plane object.
Definition shape_plane.cpp:260
STLModel GetSTLModel(int num_nodes=400) override
Generate an STL model of the Plane object.
Definition shape_plane.cpp:174
double SignedDistance(Vec3d const &pos) const override
Compute the signed distance from a given position to the surface of the Plane object.
Definition shape_plane.cpp:251
void UpdateSurfaceNodes() override
Update the surface nodes of the Plane object.
Definition shape_plane.cpp:41
double extent
Definition shape_plane.hpp:31
Vec3d SurfacePoint(Vec3d const &pos) override
Compute the surface point on the Plane object closest to a given position.
Definition shape_plane.cpp:255
VecXT< Vec3d > SupportPoints(Vec3d const &dir) override
Compute the support points of the Plane object in a given direction.
Definition shape_plane.cpp:215
void SetCenter(double c_x, double c_y, double c_z)
Set the center point of the Plane object.
Definition shape_plane.cpp:125
Plane()
Default constructor.
Definition shape_plane.cpp:7
Shape * Clone() const override
Clone the Plane object.
Definition shape_plane.cpp:95
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
virtual std::tuple< Vec3d, Vec3d > GetBoundAABB() const
Gets the boundary AABB of the shape instance.
Definition shape.cpp:128
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
std::array< double, 4 > Vec4d
Definition utils_macros.hpp:19