NEMoSys  0.63.0
A modular, extensible resource with robust automated mesh generation, mesh quality analysis, adaptive mesh refinement, and data transfer between arbitrary meshes.
ShapeBase.H
Go to the documentation of this file.
1 /*******************************************************************************
2 * Promesh *
3 * Copyright (C) 2022, IllinoisRocstar LLC. All rights reserved. *
4 * *
5 * Promesh is the property of IllinoisRocstar LLC. *
6 * *
7 * IllinoisRocstar LLC *
8 * Champaign, IL *
9 * www.illinoisrocstar.com *
10 * promesh@illinoisrocstar.com *
11 *******************************************************************************/
12 /*******************************************************************************
13 * This file is part of Promesh *
14 * *
15 * This version of Promesh is free software: you can redistribute it and/or *
16 * modify it under the terms of the GNU Lesser General Public License as *
17 * published by the Free Software Foundation, either version 3 of the License, *
18 * or (at your option) any later version. *
19 * *
20 * Promesh is distributed in the hope that it will be useful, but WITHOUT ANY *
21 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS *
22 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more *
23 * details. *
24 * *
25 * You should have received a copy of the GNU Lesser General Public License *
26 * along with this program. If not, see <https://www.gnu.org/licenses/>. *
27 * *
28 *******************************************************************************/
29 #ifndef NEMOSYS_SHAPEBASE_H_
30 #define NEMOSYS_SHAPEBASE_H_
31 
32 #include "nemosys_export.h"
33 
34 #include <array>
35 
36 namespace NEM {
37 
38 namespace SRV {
39 class NucMeshSrv;
40 } // namespace SRV
41 
42 namespace GEO {
43 class GeoManager;
44 } // namespace GEO
45 
46 namespace NUCMESH {
47 
48 /**
49  * @brief Abstract base class for types that create @c NEM::GEO::GeoManager
50  * @details Also see @c NEM::DRV::NucMeshDriver
51  */
52 class NEMOSYS_EXPORT ShapeBase {
53  public:
54  virtual ~ShapeBase() = default;
55 
56  friend class NEM::SRV::NucMeshSrv;
57  friend class ShapesArray;
58 
59  const std::array<double, 3> &getCenter() const;
60  void setCenter(const std::array<double, 3> &center);
61 
62  /**
63  * @param center Center of circle
64  * @param rotation {Radius, angle in degrees}
65  * @return Point on circle with center @p center and normal [0, 0, 1], radius
66  * @c rotation[0] and angle (in degrees) @c rotation[1]
67  */
68  static std::array<double, 3> getRotatedPoint(
69  const std::array<double, 3> &center,
70  const std::array<double, 2> &rotation);
71 
72  protected:
73  explicit ShapeBase(const std::array<double, 3> &center = {0, 0, 0});
74  ShapeBase(const ShapeBase &) = default;
75  ShapeBase &operator=(const ShapeBase &) = default;
76  ShapeBase(ShapeBase &&) = default;
77  ShapeBase &operator=(ShapeBase &&) = default;
78 
79  /**
80  * Construct a @c NEM::GEO::GeoManager
81  * @return A @c NEM::GEO::GeoManager object representing the shape described
82  * by this object
83  */
84  virtual NEM::GEO::GeoManager createGeo() const = 0;
85 
86  /**
87  * Merge two 2d @c NEM::GEO::GeoManager objects by cutting shapes in @p
88  * removeGeo from shapes in @p keepGeo and sewing the resulting faces
89  * @param[in,out] keepGeo Merge geometry from @p removeGeo into this object
90  * @param[in] removeGeo Move geometry and data from this object into @p
91  * keepGeo
92  */
93  static void mergeGeo(NEM::GEO::GeoManager &keepGeo,
94  NEM::GEO::GeoManager &&removeGeo);
95 
96  private:
97  std::array<double, 3> center_;
98 };
99 
100 } // namespace NUCMESH
101 } // namespace NEM
102 
103 #endif // NEMOSYS_SHAPEBASE_H_
Class to manage TopoDS_Shapes along with metadata.
Definition: GeoManager.H:61
std::array< double, 3 > center_
Definition: ShapeBase.H:97
Abstract base class for types that create NEM::GEO::GeoManager.
Definition: ShapeBase.H:52
Abstract base class representing a set of other ShapeBase objects, with a transformation applied to e...
Definition: ShapesArray.H:52