quality by aspect ratio
This commit is contained in:
parent
98b779db16
commit
358c8e5e44
|
@ -156,6 +156,14 @@ static void TetraFromVolume(MeshType & m)
|
|||
});
|
||||
}
|
||||
|
||||
static void TetraFromAspectRatio(MeshType & m)
|
||||
{
|
||||
tri::RequirePerTetraQuality(m);
|
||||
ForEachTetra(m, [] (MeshType::TetraType & t) {
|
||||
t.Q() = TetraQualityType(vcg::Tetra::AspectRatio(t));
|
||||
});
|
||||
}
|
||||
|
||||
static void VertexFromFace( MeshType &m, bool areaWeighted=true)
|
||||
{
|
||||
tri::RequirePerFaceQuality(m);
|
||||
|
@ -182,6 +190,31 @@ static void VertexFromFace( MeshType &m, bool areaWeighted=true)
|
|||
}
|
||||
}
|
||||
|
||||
static void VertexFromTetra(MeshType & m, bool volumeWeighted = true)
|
||||
{
|
||||
tri::RequirePerTetraQuality(m);
|
||||
tri::RequirePerVertexQuality(m);
|
||||
|
||||
SimpleTempData<typename MeshType::VertContainer, ScalarType> TQ(m.vert, 0);
|
||||
SimpleTempData<typename MeshType::VertContainer, ScalarType> TCnt(m.vert, 0);
|
||||
|
||||
ForEachTetra(m, [&] (TetraType & t) {
|
||||
TetraQualityType w = 1.;
|
||||
if (volumeWeighted)
|
||||
w = vcg::Tetra::ComputeVolume(t);
|
||||
|
||||
for (int i = 0; i < 4; ++i)
|
||||
{
|
||||
TQ[t.V(i)] += t.Q() * w;
|
||||
TCnt[t.V(i)] += w;
|
||||
}
|
||||
});
|
||||
|
||||
ForEachVertex(m, [&] (VertexType & v) {
|
||||
v.Q() = TQ[v] / TCnt[v];
|
||||
});
|
||||
}
|
||||
|
||||
template <class HandleScalar>
|
||||
static void VertexFromAttributeHandle(MeshType &m, typename MeshType::template PerVertexAttributeHandle<HandleScalar> &h)
|
||||
{
|
||||
|
|
|
@ -327,15 +327,15 @@ static typename TetraType::ScalarType DihedralAngle (const TetraType & t, const
|
|||
int f0 = Tetra::FofE(eidx, 0);
|
||||
int f1 = Tetra::FofE(eidx, 1);
|
||||
|
||||
CoordType p0 = t.P(Tetra::VofF(f0, 0));
|
||||
CoordType p1 = t.P(Tetra::VofF(f0, 1));
|
||||
CoordType p2 = t.P(Tetra::VofF(f0, 2));
|
||||
CoordType p0 = t.cP(Tetra::VofF(f0, 0));
|
||||
CoordType p1 = t.cP(Tetra::VofF(f0, 1));
|
||||
CoordType p2 = t.cP(Tetra::VofF(f0, 2));
|
||||
|
||||
CoordType n0 = ((p2 - p0) ^ (p1 - p0)).normalized();
|
||||
|
||||
p0 = t.P(Tetra::VofF(f1, 0));
|
||||
p1 = t.P(Tetra::VofF(f1, 1));
|
||||
p2 = t.P(Tetra::VofF(f1, 2));
|
||||
p0 = t.cP(Tetra::VofF(f1, 0));
|
||||
p1 = t.cP(Tetra::VofF(f1, 1));
|
||||
p2 = t.cP(Tetra::VofF(f1, 2));
|
||||
|
||||
CoordType n1 = ((p2 - p0) ^ (p1 - p0)).normalized();
|
||||
|
||||
|
|
Loading…
Reference in New Issue