Coons patch meshing

This commit is contained in:
Jakub Melka
2019-09-22 13:18:42 +02:00
parent 2ca3f907c3
commit d87995f8b8
4 changed files with 268 additions and 6 deletions

View File

@ -77,7 +77,7 @@ struct PDFMeshQualitySettings
PDFReal tolerance = 0.01;
/// Test points to determine maximal curvature of the tensor product patch meshes
PDFInteger patchTestPoints = 256;
PDFInteger patchTestPoints = 64;
/// Lower value of the surface curvature meshing resolution mapping. When ratio between
/// current curvature at the center of meshed triangle and maximal curvature is below
@ -149,6 +149,12 @@ public:
/// \param triangles New triangle array
void setTriangles(std::vector<Triangle>&& triangles) { m_triangles = qMove(triangles); }
/// Merges the vertices/triangles (renumbers triangle indices) to this mesh.
/// Algorithm assumes that vertices/triangles are numbered from zero.
/// \param vertices Added vertex array
/// \param triangles Added triangle array
void addMesh(std::vector<QPointF>&& vertices, std::vector<Triangle>&& triangles);
/// Returns vertex at given index
/// \param index Index of the vertex
const QPointF& getVertex(size_t index) const { return m_vertices[index]; }
@ -167,6 +173,9 @@ public:
/// \param backgroundColor Background color
void setBackgroundColor(QColor backgroundColor) { m_backgroundColor = backgroundColor; }
/// Returns true, if mesh is empty
bool isEmpty() const { return m_vertices.empty(); }
private:
std::vector<QPointF> m_vertices;
std::vector<Triangle> m_triangles;
@ -518,6 +527,18 @@ private:
friend class PDFPattern;
};
class PDFCoonsPatchShading : public PDFTensorProductPatchShadingBase
{
public:
explicit PDFCoonsPatchShading() = default;
virtual ShadingType getShadingType() const override;
virtual PDFMesh createMesh(const PDFMeshQualitySettings& settings) const override;
private:
friend class PDFPattern;
};
class PDFTensorProductPatchShading : public PDFTensorProductPatchShadingBase
{
public: