32 #ifndef BASE_GEOMETRY_H 33 #define BASE_GEOMETRY_H 35 #include "base_data_package.h" 67 explicit Shape(
const std::string &shape_name)
68 : name_(shape_name), is_bounds_found_(
false){};
71 std::string getName() {
return name_; };
72 void setName(
const std::string &name) { name_ = name; };
74 virtual bool isValid() {
return true; };
75 virtual bool checkContain(
const Vecd &pnt,
bool BOUNDARY_INCLUDED =
true) = 0;
76 virtual Vecd findClosestPoint(
const Vecd &input_pnt) = 0;
78 bool checkNotFar(
const Vecd &input_pnt, Real threshold);
79 bool checkNearSurface(
const Vecd &input_pnt, Real threshold);
88 bool is_bounds_found_;
93 using ShapeAndOp = std::pair<Shape *, ShapeBooleanOps>;
108 template <
class ShapeType,
typename... Args>
109 void add(Args &&...args)
111 Shape *shape = shapes_ptr_keeper_.createPtr<ShapeType>(std::forward<Args>(args)...);
112 ShapeAndOp shape_and_op(shape, ShapeBooleanOps::add);
113 shapes_and_ops_.push_back(shape_and_op);
116 template <
class ShapeType,
typename... Args>
117 void subtract(Args &&...args)
119 Shape *shape = shapes_ptr_keeper_.createPtr<ShapeType>(std::forward<Args>(args)...);
120 ShapeAndOp shape_and_op(shape, ShapeBooleanOps::sub);
121 shapes_and_ops_.push_back(shape_and_op);
124 virtual bool isValid()
override;
125 virtual bool checkContain(
const Vecd &pnt,
bool BOUNDARY_INCLUDED =
true)
override;
126 virtual Vecd findClosestPoint(
const Vecd &input_pnt)
override;
127 Shape *getShapeByName(
const std::string &shape_name);
128 ShapeAndOp *getShapeAndOpByName(
const std::string &shape_name);
129 size_t getShapeIndexByName(
const std::string &shape_name);
133 StdVec<ShapeAndOp> shapes_and_ops_;
145 template <
typename InEdgeType,
typename OutEdgeType>
150 template <
class EdgeStructureType>
151 explicit Edge(EdgeStructureType *structure)
152 :
id_(structure->ContainerSize()),
in_edge_(MaxSize_t){};
154 template <
class EdgeStructureType>
155 Edge(InEdgeType in_edge, EdgeStructureType *structure)
156 :
id_(structure->ContainerSize()),
in_edge_(in_edge){};
164 #endif // BASE_GEOMETRY_H template base class of linear structure only with topology information. Note that a edge is defined t...
Definition: base_geometry.h:146
size_t id_
Definition: base_geometry.h:157
Base class for all volumetric geometries Note that checkContain and findClosest point are basic funct...
Definition: base_geometry.h:64
Vecd findNormalDirection(const Vecd &input_pnt)
Definition: base_geometry.cpp:36
Edge(EdgeStructureType *structure)
Definition: base_geometry.h:151
Real findSignedDistance(const Vecd &input_pnt)
Definition: base_geometry.cpp:30
OutEdgeType out_edge_
Definition: base_geometry.h:161
A wrapper to provide an ownership for a vector of base class pointers which point to derived objects...
Definition: ownership.h:127
a collections of shapes with binary operations This class so that it has ownership of all shapes by u...
Definition: base_geometry.h:101
Set up of basic data structure.
Boolean operation for generate complex shapes.
Edge(InEdgeType in_edge, EdgeStructureType *structure)
Definition: base_geometry.h:155
InEdgeType in_edge_
Definition: base_geometry.h:160
Definition: solid_body_supplementary.cpp:9