summaryrefslogtreecommitdiff
path: root/thirdparty/thekla_atlas/nvmesh/param/ParameterizationQuality.h
blob: 342e26b8897a257a1f27a9bf6ae3fc7ac6b38ad2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// Copyright NVIDIA Corporation 2008 -- Ignacio Castano <icastano@nvidia.com>

#pragma once
#ifndef NV_MESH_PARAMETERIZATIONQUALITY_H
#define NV_MESH_PARAMETERIZATIONQUALITY_H

#include <nvmesh/nvmesh.h>

namespace nv
{
    class Vector2;
    class Vector3;

    namespace HalfEdge { class Mesh; }

    // Estimate quality of existing parameterization.
    NVMESH_CLASS class ParameterizationQuality
    {
    public:
        ParameterizationQuality();
        ParameterizationQuality(const HalfEdge::Mesh * mesh);

        bool isValid() const;

        float rmsStretchMetric() const;
        float maxStretchMetric() const;

        float rmsConformalMetric() const;
        float maxAuthalicMetric() const;

        void operator += (const ParameterizationQuality & pq);

    private:

        void processTriangle(Vector3 p[3], Vector2 t[3]);

    private:

        uint m_totalTriangleCount;
        uint m_flippedTriangleCount;
        uint m_zeroAreaTriangleCount;

        float m_parametricArea;
        float m_geometricArea;

        float m_stretchMetric;
        float m_maxStretchMetric;

        float m_conformalMetric;
        float m_authalicMetric;

    };

} // nv namespace

#endif // NV_MESH_PARAMETERIZATIONQUALITY_H