ClipGeometry.hpp
1 /*---------------------------------------------------------------------------*\
2  *
3  * mimmo
4  *
5  * Copyright (C) 2015-2021 OPTIMAD engineering Srl
6  *
7  * -------------------------------------------------------------------------
8  * License
9  * This file is part of mimmo.
10  *
11  * mimmo is free software: you can redistribute it and/or modify it
12  * under the terms of the GNU Lesser General Public License v3 (LGPL)
13  * as published by the Free Software Foundation.
14  *
15  * mimmo is distributed in the hope that it will be useful, but WITHOUT
16  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
18  * License for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public License
21  * along with mimmo. If not, see <http://www.gnu.org/licenses/>.
22  *
23 \*---------------------------------------------------------------------------*/
24 #ifndef __CLIPGEOMETRY_HPP__
25 #define __CLIPGEOMETRY_HPP__
26 
27 #include "BaseManipulation.hpp"
28 
29 namespace mimmo{
30 
86 private:
87  darray4E m_plane;
88  bool m_insideout;
90  darray3E m_origin;
91  darray3E m_normal;
92  bool m_implicit;
94 public:
95  ClipGeometry();
96  ClipGeometry(const bitpit::Config::Section & rootXML);
97  ~ClipGeometry();
98 
99  ClipGeometry(const ClipGeometry & other);
100 
101  void buildPorts();
102 
103  bool isInsideOut();
106 
107  void setClipPlane(darray4E plane);
108  void setClipPlane(darray3E origin, darray3E normal);
109  void setOrigin(darray3E origin);
110  void setNormal(darray3E normal);
111  void setInsideOut(bool flag);
113 
114  void execute();
115 
116  virtual void absorbSectionXML(const bitpit::Config::Section & slotXML, std::string name = "");
117  virtual void flushSectionXML(bitpit::Config::Section & slotXML, std::string name= "");
118 
119 protected:
120  virtual void plotOptionalResults();
121 
122 private:
123  livector1D clipPlane();
124 
125 };
126 
127 
128 REGISTER_PORT(M_PLANE, MC_ARRAY4, MD_FLOAT,__CLIPGEOMETRY_HPP__)
129 REGISTER_PORT(M_POINT, MC_ARRAY3, MD_FLOAT,__CLIPGEOMETRY_HPP__)
130 REGISTER_PORT(M_AXIS, MC_ARRAY3, MD_FLOAT,__CLIPGEOMETRY_HPP__)
131 REGISTER_PORT(M_VALUEB, MC_SCALAR, MD_BOOL,__CLIPGEOMETRY_HPP__)
132 REGISTER_PORT(M_GEOM, MC_SCALAR, MD_MIMMO_,__CLIPGEOMETRY_HPP__)
133 
134 REGISTER(BaseManipulation, ClipGeometry, "mimmo.ClipGeometry")
135 }
136 
137 #endif /* __CLIPGEOMETRY_HPP__ */
std::array< double, 4 > darray4E
#define M_GEOM
void setOrigin(darray3E origin)
#define MC_ARRAY3
#define MD_FLOAT
virtual void flushSectionXML(bitpit::Config::Section &slotXML, std::string name="")
std::vector< long > livector1D
void setClipPlane(darray4E plane)
#define M_POINT
BaseManipulation is the base class of any manipulation object of the library.
virtual void plotOptionalResults()
#define MC_ARRAY4
MimmoSharedPointer< MimmoObject > getClippedPatch()
#define MC_SCALAR
void setInsideOut(bool flag)
#define REGISTER_PORT(Name, Container, Datatype, ManipBlock)
virtual void absorbSectionXML(const bitpit::Config::Section &slotXML, std::string name="")
#define M_PLANE
#define MD_BOOL
ClipGeometry is a class that clip a 3D geometry according to a plane intersecting it.
#define MD_MIMMO_
void setGeometry(MimmoSharedPointer< MimmoObject > geometry)
std::array< double, 3 > darray3E
void setNormal(darray3E normal)
#define M_AXIS
MimmoSharedPointer is a custom implementation of shared pointer.
#define M_VALUEB
#define REGISTER(Base, Derived, name)
Definition: factory.hpp:206