G+Smo  24.08.0
Geometry + Simulation Modules
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
gsTriMeshToSolid.h
Go to the documentation of this file.
1 
15 #pragma once
16 
17 #include <gsUtils/gsMesh/gsMesh.h>
18 
19 namespace gismo
20 {
21 
30 template<class T>
32 {
33 public:
34  // typedefs
35  typedef gsMeshElement<T> MeshElement;
36  typedef typename MeshElement::scalar_t scalar_t;
38  typedef typename MeshElement::gsFaceHandle FaceHandle;
39  typedef typename MeshElement::gsEdgeHandle EdgeHandle;
40  typedef gsEdge<T> Edge;
41  typedef gsVertex<T> Vertex;
42 
43  // constructors
44  gsTriMeshToSolid(gsMesh<T> *sourceMesh):
45  mesh(sourceMesh),
46  vertex(sourceMesh->m_vertex),
47  face(sourceMesh->m_face),
48  edge(sourceMesh->m_edge)
49  {}
50 
51  // public functions
52 
120  void getPatchData(T angle, T innerAngle, T patchAreaWeight, T mergeSmallPatches,
121  std::vector<std::vector<VertexHandle> > & iPoints,
122  std::vector<std::vector<VertexHandle> > & oPoints,
123  std::vector< std::vector<std::vector<VertexHandle> > > & innerBdrys,
124  std::vector< std::vector<Vertex> > & innerBdrysMassP,
125  std::vector<std::vector<bool> > & oPointsConvexFlag,
126  std::string filenameFeatures,
127  int useFeatures);
128 
129 
136  void getFeatures(T angleGrad,bool& bWarnNonManifold,bool& bWarnBorders);
137 
140  void calcPatchNumbers();
141 
146  void setSharpEdges(std::vector< gsEdge<T> > & featEdges, int useFeatures);
147 
148 
150  void storeNeighboringFaces();
151 
161  void divideAndMergePatches(T innerAngle, T patchAreaWeight, T mergeSmallPatches);
162 
173  void getFaces(std::vector<std::vector<VertexHandle> > & iPoints, std::vector<std::vector<VertexHandle> > & oPoints,
174  std::vector< std::vector<std::vector<VertexHandle> > > & innerBdrys, std::vector< std::vector<Vertex> > & innerBdrysMassP,
175  std::vector<std::vector<bool> > & oPointsConvexFlag);
176 
177 
209  void toSolid(gsSolid<T> & sl, std::vector<std::vector<VertexHandle> > & iPoints,
210  std::vector<std::vector<VertexHandle> > & oPoints,
211  std::vector< std::vector<std::vector<VertexHandle> > > & innerBdrys,
212  std::vector< std::vector<Vertex> > & innerBdrysMassP,
213  std::vector<std::vector<bool> > & oPointsConvexFlag, std::vector<gsMesh<T> *> &paraMeshes,
214  std::vector<gsMesh<T> *> &fitMeshes, std::vector<gsMesh<T> *> &patchMeshes, int kvOuterPoints,
215  int kvAdditionalInnerPoints,
216  bool plot, int meshPoints, bool moreInner=true,
217  T wE=5, T wI=1, int closeBoundary=0, bool noSmooth=false);
218 
225  gsCurveLoop<T> * calculateLoop(std::vector<Vertex> outerPoints, std::vector<bool > const & isCorner, bool noSmooth = false);
226 
227 
232  static int normalMult(gsVector3d<T> globalNormal,
233  std::vector<FaceHandle> & face, int bigFaceIdx);
234 
239  static T calcArea(FaceHandle f1);
240 
247  static T calcWeight(VertexHandle v1,VertexHandle v2,
248  std::set<VertexHandle>
249  const & vertexFaceSet);
250 
258  static bool approxEqual(const gsEdge<T> & e1,const gsEdge<T> & e2);
259 
260 
267  static T calcAngle(EdgeHandle e1,EdgeHandle e2, int faceNum);
268 
269 
274  static T calcBdryLength(std::vector<VertexHandle > vec);
275 
276 
281  static gsVertex<T> getMassP(std::vector<VertexHandle > vec);
282 
283 
289  static T calcDist(VertexHandle v1,VertexHandle v2);
290 
291 
292  // Documentation guessed by S.K.
299  static std::vector<bool> isCorner(std::vector<VertexHandle > const & vertexVec3d);
300 
301 
308 
309 
317 
318 
324  static Vertex giveMidpoint(Vertex v1,Vertex v2);
325 
326 
331  void readEdges( std::string const & fn, std::vector<gsEdge <T> > & edges );
332 
333 
334  // public members
335  gsMesh<> *mesh;
336 
337  int numEdges;
338  int numBigFaces;
339  std::vector<VertexHandle > &vertex;
340  std::vector<FaceHandle > &face;
341  gsSortedVector<Edge> &edge;
342 };
343 
344 }
345 
346 
347 #ifndef GISMO_BUILD_LIB
348 #include GISMO_HPP_HEADER(gsTriMeshToSolid.hpp)
349 #endif
static T calcBdryLength(std::vector< VertexHandle > vec)
Adds up the lengths between 2 neighboring vertices of a vector of vertices.
Definition: gsTriMeshToSolid.hpp:1677
A fixed-size, statically allocated 3D vector.
Definition: gsVector.h:218
static T calcArea(FaceHandle f1)
using Heron&#39;s Formula for the area of a triangle.
Definition: gsTriMeshToSolid.hpp:1798
void setSharpEdges(std::vector< gsEdge< T > > &featEdges, int useFeatures)
Sets sharp edges according to the value of useFeatures.
Definition: gsTriMeshToSolid.hpp:185
gsBSpline< T > * calcTCurve(Vertex v1, Vertex v2)
calculates a B-spline of degree one from 2 vertices.
Definition: gsTriMeshToSolid.hpp:1727
static bool approxEqual(const gsEdge< T > &e1, const gsEdge< T > &e2)
checks if two edges are very close to each other.
Definition: gsTriMeshToSolid.hpp:1597
void getPatchData(T angle, T innerAngle, T patchAreaWeight, T mergeSmallPatches, std::vector< std::vector< VertexHandle > > &iPoints, std::vector< std::vector< VertexHandle > > &oPoints, std::vector< std::vector< std::vector< VertexHandle > > > &innerBdrys, std::vector< std::vector< Vertex > > &innerBdrysMassP, std::vector< std::vector< bool > > &oPointsConvexFlag, std::string filenameFeatures, int useFeatures)
Computes data describing the patch structure of the mesh. Combines getFeatures and getFaces...
Definition: gsTriMeshToSolid.hpp:1405
static T calcWeight(VertexHandle v1, VertexHandle v2, std::set< VertexHandle > const &vertexFaceSet)
calculates a weight between 2 vertices used in Floater&#39;s algorithm.
Definition: gsTriMeshToSolid.hpp:1531
A B-spline function of one argument, with arbitrary target dimension.
Definition: gsBSpline.h:50
Class Representing a triangle mesh with 3D vertices.
Definition: gsMesh.h:31
void getFaces(std::vector< std::vector< VertexHandle > > &iPoints, std::vector< std::vector< VertexHandle > > &oPoints, std::vector< std::vector< std::vector< VertexHandle > > > &innerBdrys, std::vector< std::vector< Vertex > > &innerBdrysMassP, std::vector< std::vector< bool > > &oPointsConvexFlag)
Computes data describing the patch structure of the mesh.
Definition: gsTriMeshToSolid.hpp:311
static Vertex giveMidpoint(Vertex v1, Vertex v2)
calculates the midpoint of two vertices.
Definition: gsTriMeshToSolid.hpp:1747
static std::vector< bool > isCorner(std::vector< VertexHandle > const &vertexVec3d)
checks whether vertices are corners.
Definition: gsTriMeshToSolid.hpp:1712
Class gsTriMeshToSolid object.
Definition: gsTriMeshToSolid.h:31
void toSolid(gsSolid< T > &sl, std::vector< std::vector< VertexHandle > > &iPoints, std::vector< std::vector< VertexHandle > > &oPoints, std::vector< std::vector< std::vector< VertexHandle > > > &innerBdrys, std::vector< std::vector< Vertex > > &innerBdrysMassP, std::vector< std::vector< bool > > &oPointsConvexFlag, std::vector< gsMesh< T > * > &paraMeshes, std::vector< gsMesh< T > * > &fitMeshes, std::vector< gsMesh< T > * > &patchMeshes, int kvOuterPoints, int kvAdditionalInnerPoints, bool plot, int meshPoints, bool moreInner=true, T wE=5, T wI=1, int closeBoundary=0, bool noSmooth=false)
Parametrized a number of patches given by iPoints, oPoints, innerBdrys, innerBdrysMassP and oPointsCo...
Definition: gsTriMeshToSolid.hpp:566
Provides declaration of the Mesh class.
void readEdges(std::string const &fn, std::vector< gsEdge< T > > &edges)
reads a text file consisting of lines of 6 values, each line representing an edge.
Definition: gsTriMeshToSolid.hpp:1756
void divideAndMergePatches(T innerAngle, T patchAreaWeight, T mergeSmallPatches)
Improve surface segmentation by using more complex rules.
Definition: gsTriMeshToSolid.hpp:239
static T calcDist(VertexHandle v1, VertexHandle v2)
calculates the distance between 2 vertices.
Definition: gsTriMeshToSolid.hpp:1705
Class for representing a solid made up of vertices, edges, faces, and volumes.
Definition: gsSolid.h:32
static gsVertex< T > getMassP(std::vector< VertexHandle > vec)
calculates the mass point of a vector of vertices.
Definition: gsTriMeshToSolid.hpp:1688
void storeNeighboringFaces()
Store each edge&#39;s neighboring faces.
Definition: gsTriMeshToSolid.hpp:222
A closed loop given by a collection of curves.
Definition: gsCurveLoop.h:36
static int normalMult(gsVector3d< T > globalNormal, std::vector< FaceHandle > &face, int bigFaceIdx)
Definition: gsTriMeshToSolid.hpp:1562
gsCurveLoop< T > * calculateLoop(std::vector< Vertex > outerPoints, std::vector< bool > const &isCorner, bool noSmooth=false)
calculates a curve loop consisting of B-spline curves of degree one and two from a vector of vertices...
Definition: gsTriMeshToSolid.hpp:1444
void getFeatures(T angleGrad, bool &bWarnNonManifold, bool &bWarnBorders)
generates edges for a mesh consisting of vertices and faces. Determines if these edges are sharp...
Definition: gsTriMeshToSolid.hpp:72
void calcPatchNumbers()
Each face obtains a patch number, faces of the same number belong to the same patch.
Definition: gsTriMeshToSolid.hpp:27
gsVertex class that represents a 3D vertex for a gsMesh.
Definition: gsVertex.h:26
static T calcAngle(EdgeHandle e1, EdgeHandle e2, int faceNum)
calculates the conditioned angle between 2 edges.
Definition: gsTriMeshToSolid.hpp:1617