libsurf
Programmer's Documentation

patchmeshgenerator.h (r6227/r5805)
1 #ifndef SURF_PATCHMESHGENERATOR_H
2 #define SURF_PATCHMESHGENERATOR_H
3 
4 #include "forward.h"
5 #include "uvmapping.h"
6 #include "dcmeshcrit.h"
7 #include "jrstriangle/jrstrianglewrapper.h"
8 #include <genua/radialsort.h>
9 #include <genua/trimesh.h>
10 
12 {
13 public:
14 
17 
19  virtual ~PatchMeshGenerator() {}
20 
22  SurfacePtr surface() const {return m_psf;}
23 
25  void criterion(DcMeshCritBasePtr pmc);
26 
28  virtual void initMap(SurfacePtr psf);
29 
31  virtual void punchHole(const Vct2 &ph);
32 
34  Indices insertSegmentPoints(const PointList2d &pts);
35 
37  virtual size_t enforceConstraint(const PointList2d &uvp, int tag = 0);
38 
40  virtual size_t enforceConstraint(const Indices &cvi, int tag = 0) = 0;
41 
43  virtual size_t refineBoundaries() = 0;
44 
46  virtual size_t generate(const PointList2d &uvini) = 0;
47 
49  virtual void smooth() = 0;
50 
52  const PointList2d &uvVertices() const {return m_uvp;}
53 
55  virtual void importMesh(const PointList2d &uvp,
56  const Indices &tri, int tag=0);
57 
58 protected:
59 
61  void initUvMap(SurfacePtr psf, UvMapping &uvmap);
62 
64  RadialOrdering radiusOrder() const;
65 
67  uint insertSegmentPoint(RadialOrdering &porder, const Vct2 &p);
68 
69 protected:
70 
72  SurfacePtr m_psf;
73 
75  PointList2d m_uvp;
76 
78  PointList2d m_holes;
79 
81  DcMeshCritBasePtr m_pmc;
82 
84  DcMeshCritPtr m_mcp;
85 
87  Real m_sqmergetol = 1e-7;
88 };
89 
90 #endif // PATCHMESHGENERATOR_H
PatchMeshGenerator()
do nothing
Definition: patchmeshgenerator.h:16
virtual void punchHole(const Vct2 &ph)
mark point as hole
Definition: patchmeshgenerator.cpp:24
Definition: patchmeshgenerator.h:11
virtual size_t generate(const PointList2d &uvini)=0
create mesh from initial points and perform refinement passes
virtual ~PatchMeshGenerator()
destruct
Definition: patchmeshgenerator.h:19
Parameter-space mapping.
Definition: uvmapping.h:34
DcMeshCritBasePtr m_pmc
criterion used for meshing
Definition: patchmeshgenerator.h:81
virtual size_t enforceConstraint(const PointList2d &uvp, int tag=0)
add a set of constraints in (u,v) space as a polyline
Definition: patchmeshgenerator.cpp:81
virtual void initMap(SurfacePtr psf)
initialize 2D space mapping
Definition: patchmeshgenerator.cpp:19
DcMeshCritPtr m_mcp
cast to specialization or null
Definition: patchmeshgenerator.h:84
virtual void smooth()=0
apply some barycentric smoothing iterations
Indices insertSegmentPoints(const PointList2d &pts)
insert a set of boundary points, check for equality with existing points
Definition: patchmeshgenerator.cpp:93
uint insertSegmentPoint(RadialOrdering &porder, const Vct2 &p)
insert a single point using the sq-distance ordering, return new index
Definition: patchmeshgenerator.cpp:141
virtual void importMesh(const PointList2d &uvp, const Indices &tri, int tag=0)
import entire mesh in parameter domain
Definition: patchmeshgenerator.cpp:29
SurfacePtr surface() const
assigned surface
Definition: patchmeshgenerator.h:22
Real m_sqmergetol
when two points are regarded as identical
Definition: patchmeshgenerator.h:87
virtual size_t refineBoundaries()=0
use the assigned criterion to refine any boundary segments
void initUvMap(SurfacePtr psf, UvMapping &uvmap)
initialize 2D space mapping
Definition: patchmeshgenerator.cpp:60
void criterion(DcMeshCritBasePtr pmc)
assign criterion
Definition: patchmeshgenerator.cpp:13
PointList2d m_uvp
mesh points in (u,v) space
Definition: patchmeshgenerator.h:75
RadialOrdering radiusOrder() const
generate a radius-ordering of current (u,v) points
Definition: patchmeshgenerator.cpp:86
SurfacePtr m_psf
surface to mesh
Definition: patchmeshgenerator.h:72
PointList2d m_holes
holes in uv-plane (if any)
Definition: patchmeshgenerator.h:78
const PointList2d & uvVertices() const
access points in (u,v) space
Definition: patchmeshgenerator.h:52
Generated on Mon Jan 24 2022 03:03:16 for libsurf by   doxygen 1.8.5