/// <summary> /// Initializes a new instance of the <see cref="QualityMeasure" /> class. /// </summary> public QualityMeasure(IMesh mesh) { areaMeasure = new AreaMeasure(); alphaMeasure = new AlphaMeasure(); qMeasure = new Q_Measure(); Point a, b, c; double ab, bc, ca; double lx, ly; double area; int n = 0; foreach (var tri in mesh.Triangles) { n++; a = tri.vertices[0]; b = tri.vertices[1]; c = tri.vertices[2]; lx = a.x - b.x; ly = a.y - b.y; ab = Math.Sqrt(lx * lx + ly * ly); lx = b.x - c.x; ly = b.y - c.y; bc = Math.Sqrt(lx * lx + ly * ly); lx = c.x - a.x; ly = c.y - a.y; ca = Math.Sqrt(lx * lx + ly * ly); area = areaMeasure.Measure(a, b, c); alphaMeasure.Measure(ab, bc, ca, area); qMeasure.Measure(ab, bc, ca, area); } // Normalize measures alphaMeasure.Normalize(n, areaMeasure.area_total); qMeasure.Normalize(n, areaMeasure.area_total); }
public QualityMeasure() { areaMeasure = new AreaMeasure(); alphaMeasure = new AlphaMeasure(); qMeasure = new Q_Measure(); }