libsurf
Programmer's Documentation

meshpatch.h (r6227/r5385)
1 
2 /* Copyright (C) 2015 David Eller <david@larosterna.com>
3  *
4  * Commercial License Usage
5  * Licensees holding valid commercial licenses may use this file in accordance
6  * with the terms contained in their respective non-exclusive license agreement.
7  * For further information contact david@larosterna.com .
8  *
9  * GNU General Public License Usage
10  * Alternatively, this file may be used under the terms of the GNU General
11  * Public License version 3.0 as published by the Free Software Foundation and
12  * appearing in the file gpl.txt included in the packaging of this file.
13  */
14 
15 #ifndef SURF_MESHPATCH_H
16 #define SURF_MESHPATCH_H
17 
18 #include <boost/shared_ptr.hpp>
19 #include <genua/trimesh.h>
20 #include <genua/boxsearchtree.h>
21 #include <genua/bounds.h>
22 #include "edgefaceisec.h"
23 #include "surface.h"
24 
25 class DnRefineCriterion;
26 struct IsecTopology;
27 
28 typedef std::vector<PointList<2> > IpointSet;
29 
30 typedef enum { MgSuccess=0,
31  MgBoundaryReplacementMismatch,
32  MgCollidingIntersections } MgError;
33 
34 typedef enum { IsNoIntersection,
35  IsSingleLoop,
36  IsTwinLoop,
37  IsSingleDivision,
38  IsTwinDivision,
39  IsEdgeBite,
40  IsTwinEdgeBite,
41  IsCornerBite,
42  IsOpenCut,
43  IsMultiple,
44  IsStrangeShape,
45  IsSpatialLoopNotClosed,
46  IsUnclassified
47  } IsecShape;
48 
49 
61 class MeshPatch : public TriMesh
62 {
63  public:
64 
66  MeshPatch() {}
67 
69  MeshPatch(SurfacePtr psf) : srf(psf) {}
70 
72  uint nholes() const {return holes.size();}
73 
75  Vct2 & phole(uint i) {
76  assert(i < holes.size());
77  return holes[i];
78  }
79 
81  void addConstraints(const PointList<2> & c);
82 
84  void addIntersections(const IsecSet & isl);
85 
87  void premesh(const DnRefineCriterion & crit, bool psm=false);
88 
90  MgError mesh(const DnRefineCriterion & crit, bool psm=true, bool pir=true);
91 
93  MgError meshCoarse(const DnRefineCriterion & crit);
94 
96  const Vct2 & parameter(uint i) const {
97  assert(i < ppt.size());
98  return ppt[i];
99  }
100 
102  Vct3 eval(Real u, Real v) const {return srf->eval(u,v);}
103 
105  Vct3 normal(Real u, Real v) const {return srf->normal(u,v);}
106 
108  const SurfacePtr & surface() const {return srf;}
109 
111  virtual void fixate();
112 
114  void boundaryPoints(side_t s, Indices & si) const;
115 
116  protected:
117 
119  void convert(const IsecLine & line, PointList<2> & pts) const;
120 
122  void convert(const IsecSet & isl, IpointSet & pts) const;
123 
125  void filterConstraint(const IsecLine & isl, PointList<2> & cpt,
126  PointList<3> & rpt) const;
127 
128  private:
129 
131  SurfacePtr srf;
132 
134  PointList<2> bdd, ppt, holes;
135 
137  IpointSet ipl, stc;
138 
140  Indices rpi;
141 
144 
147 
149  // uint ncp;
150 };
151 
152 typedef boost::shared_ptr<MeshPatch> MeshPatchPtr;
153 typedef std::vector<MeshPatchPtr> MeshPatchList;
154 
155 #endif
156 
uint size() const
Vct3 eval(Real u, Real v) const
evaluate underlying surface
Definition: meshpatch.h:102
Generates the triangulation of a single surface.
Definition: meshpatch.h:61
PointList< 2 > bdd
boundary discretization and final parameter point set
Definition: meshpatch.h:134
Vct2 & phole(uint i)
access hole marker point (for manual modifications)
Definition: meshpatch.h:75
void addConstraints(const PointList< 2 > &c)
add arbitrary additional constraints
Definition: meshpatch.cpp:44
Vct3 normal(Real u, Real v) const
compute normal on underlying surface
Definition: meshpatch.h:105
BSearchTree tree
search tree for nearest neighbor searches
Definition: meshpatch.h:146
IpointSet ipl
intersections and additional constraints for structural model
Definition: meshpatch.h:137
void addIntersections(const IsecSet &isl)
add constraints from intersection lines (manual, no hole processing)
Definition: meshpatch.cpp:60
MgError meshCoarse(const DnRefineCriterion &crit)
specialized version to generate coarse wing mesh
Definition: meshpatch.cpp:187
SurfacePtr srf
pointer to surface
Definition: meshpatch.h:131
const SurfacePtr & surface() const
access spline surface
Definition: meshpatch.h:108
virtual void fixate()
overload triangulation fixate: create search tree
Definition: meshpatch.cpp:318
MgError mesh(const DnRefineCriterion &crit, bool psm=true, bool pir=true)
generate a constrained patch mesh (may fail in constraint handling)
Definition: meshpatch.cpp:105
Indices rpi
indices of replacement points
Definition: meshpatch.h:140
void filterConstraint(const IsecLine &isl, PointList< 2 > &cpt, PointList< 3 > &rpt) const
construct constraint points and 3D replacements
Definition: meshpatch.cpp:324
void premesh(const DnRefineCriterion &crit, bool psm=false)
generate an unconstrained patch mesh (should never fail)
Definition: meshpatch.cpp:78
MeshPatch()
empty constructor
Definition: meshpatch.h:66
uint nholes() const
number of hole markers
Definition: meshpatch.h:72
PointList< 3 > rpp
coordinates of replacement points
Definition: meshpatch.h:143
MeshPatch(SurfacePtr psf)
initialize with surface pointer
Definition: meshpatch.h:69
void convert(const IsecLine &line, PointList< 2 > &pts) const
convert from IsecLine to list of parameter points
Definition: meshpatch.cpp:304
Simplest mesh refinement criterion.
Definition: dnrefine.h:43
Definition: intersect.h:60
void boundaryPoints(side_t s, Indices &si) const
identify boundary points in 3D
Definition: meshpatch.cpp:378
const Vct2 & parameter(uint i) const
access parameter values
Definition: meshpatch.h:96
Generated on Wed Jan 19 2022 03:03:15 for libsurf by   doxygen 1.8.5