Polyhedral-net Splines
Loading...
Searching...
No Matches
PatchBuilder.hpp
1/* copyright(c)Jorg Peters [jorg.peters@gmail.com] */
2
3#pragma once
4
5#include <OpenMesh/Core/Mesh/PolyMesh_ArrayKernelT.hh>
6#include <vector>
7#include "../Helper/Helper.hpp"
8#include "../Subdivision/subdivision.hpp"
9#include "../Subdivision/VertexMapping.hpp"
10
11typedef OpenMesh::PolyMesh_ArrayKernelT<> MeshType;
12typedef MeshType::VertexHandle VertexHandle;
13
14class PatchConstructor; // forward declaration
15
28{
29 public:
34 std::vector<VertexHandle> m_NBVertexHandles;
45
55 int m_DegU = -1;
60 int m_DegV = -1;
61
71 PatchBuilder(const MeshType& a_Mesh, std::vector<VertexHandle> a_NBVertexHandles, const Matrix& a_Mask, PatchConstructor* a_PatchConstructor, int a_NumOfPatches);
72
83 PatchBuilder(const MeshType& a_Mesh, std::vector<VertexHandle> a_NBVertexHandles, const Matrix& a_Mask, PatchConstructor* a_PatchConstructor, int a_DegU, int a_DegV);
84
90 PatchBuilder(const PatchBuilder& a_PatchBuilder)
91 : m_NBVertexHandles(a_PatchBuilder.m_NBVertexHandles), m_Mask(a_PatchBuilder.m_Mask), m_PatchConstructor(a_PatchBuilder.m_PatchConstructor), m_NumOfPatches(a_PatchBuilder.m_NumOfPatches), m_DegU(a_PatchBuilder.m_DegU), m_DegV(a_PatchBuilder.m_DegV) {};
92
96 PatchBuilder& operator=(const PatchBuilder& a_PatchBuilder);
104 std::vector<Patch> buildPatches(const MeshType& a_Mesh) const;
105
111 std::vector<VertexHandle> getNeighborVerts() const;
112
118 Matrix getMask() const;
119
126
131 void degRaise();
132
138 int numPatches() const;
139 private:
140 void initializeMaskAndNeighborVertices(const MeshType& a_Mesh, std::vector<VertexHandle> a_NBVertexHandles, const Matrix& a_Mask);
141};
Definition Matrix.hpp:11
A builder class for constructing Bézier patches from a mesh.
Definition PatchBuilder.hpp:28
void degRaise()
Raises the degree of the bezier patches by upto degree 3 in each direction. Nothing happens if the de...
Definition PatchBuilder.cpp:52
PatchBuilder(const MeshType &a_Mesh, std::vector< VertexHandle > a_NBVertexHandles, const Matrix &a_Mask, PatchConstructor *a_PatchConstructor, int a_NumOfPatches)
Constructs a PatchBuilder with the given neighboring vertex handles, mask, patch constructor and numb...
Definition PatchBuilder.cpp:6
PatchBuilder & operator=(const PatchBuilder &a_PatchBuilder)
Assignment operator.
Definition PatchBuilder.cpp:24
std::vector< Patch > buildPatches(const MeshType &a_Mesh) const
Builds the Bézier patches using the current vertex positions in the given mesh.
Definition PatchBuilder.cpp:42
Matrix getMask() const
Get the Mask object. The linear transformation that maps the neighboring vertices to the coefficients...
Definition PatchBuilder.cpp:38
std::vector< VertexHandle > getNeighborVerts() const
Get the Neighbor Verts object that are used to construct the bezier patches for this PnS patch.
Definition PatchBuilder.cpp:36
int m_DegV
The degree in v direction of each bézier patch this PnS patch type outputs.
Definition PatchBuilder.hpp:60
int numPatches() const
Get the Num Patches object. The number of bezier patches this PnS patch type outputs.
Definition PatchBuilder.cpp:144
int m_DegU
The degree in u direction of each bézier patch this PnS patch type outputs.
Definition PatchBuilder.hpp:55
PatchBuilder(const PatchBuilder &a_PatchBuilder)
Construct a new Patch Builder object.
Definition PatchBuilder.hpp:90
int m_NumOfPatches
The number of bézier patches this PnS patch type outputs.
Definition PatchBuilder.hpp:50
PatchConstructor * m_PatchConstructor
The patch constructor that created this patch builder.
Definition PatchBuilder.hpp:44
Matrix m_Mask
The mask used to construct the patch.
Definition PatchBuilder.hpp:39
std::vector< VertexHandle > m_NBVertexHandles
The neighboring vertex handles used to construct the patch.
Definition PatchBuilder.hpp:34
const PatchConstructor * getPatchConstructor() const
Get the PatchConstructor object that created this PatchBuilder.
Definition PatchBuilder.cpp:40
Abstract base class for patch constructors.
Definition PatchConstructor.hpp:66