dellepiane: fixed issues with per-face quality histogram. Modified the xml to include "area weighted" option

This commit is contained in:
Matteo Dellepiane matteodelle 2016-10-25 09:19:13 +00:00
parent 59f20f8bf0
commit b2ea12baee
2 changed files with 40 additions and 3 deletions

View File

@ -394,6 +394,37 @@ bool FilterMeasurePlugin::applyFilter( const QString& filterName,MeshDocument& m
Log("[%15.7f..%15.7f) : %4.0f", H.BinLowerBound(i), H.BinUpperBound(i), H.BinCountInd(i));
Log("[%15.7f.. +inf) : %4.0f", RangeMax, H.BinCountInd(binNum + 1));
}
if (filterName == "Per Vertex Quality Histogram")
{
vector<Scalarm> aVec(m.vn, 1.0);
if (areaFlag)
tri::MeshToMatrix<CMeshO>::PerVertexArea(m, aVec);
for (size_t i = 0; i<m.vn; ++i)
H.Add(m.vert[i].Q(), aVec[i]);
}
else{
vector<Scalarm> aVec(m.fn, 1.0);
if (areaFlag)
tri::MeshToMatrix<CMeshO>::PerFaceArea(m, aVec);
for (size_t i = 0; i<m.fn; ++i)
H.Add(m.face[i].Q(), aVec[i]);
}
if (areaFlag)
{
Log("( -inf..%15.7f) : %15.7f", RangeMin, H.BinCountInd(0));
for (int i = 1; i <= binNum; ++i)
Log("[%15.7f..%15.7f) : %15.7f", H.BinLowerBound(i), H.BinUpperBound(i), H.BinCountInd(i));
Log("[%15.7f.. +inf) : %15.7f", RangeMax, H.BinCountInd(binNum + 1));
}
else
{
Log("( -inf..%15.7f) : %4.0f", RangeMin, H.BinCountInd(0));
for (int i = 1; i <= binNum; ++i)
Log("[%15.7f..%15.7f) : %4.0f", H.BinLowerBound(i), H.BinUpperBound(i), H.BinCountInd(i));
Log("[%15.7f.. +inf) : %4.0f", RangeMax, H.BinCountInd(binNum + 1));
}
return true;
}

View File

@ -55,16 +55,22 @@
</FILTER>
<FILTER filterName="Per Face Quality Histogram" filterFunction="computeFaceQualityHistogram" filterClass="Measure" filterPre="MM_FACEQUALITY" filterPost="MM_NONE" filterArity="SingleMesh" filterRasterArity="NoRaster" filterIsInterruptible="false">
<FILTER_HELP><![CDATA[Compute an histogram of the values of the per-vertex quality.]]></FILTER_HELP>
<FILTER_HELP><![CDATA[Compute an histogram of the values of the per-face quality.]]></FILTER_HELP>
<FILTER_JSCODE><![CDATA[]]></FILTER_JSCODE>
<PARAM parType="Real" parName="HistMin" parDefault="meshDoc.current().computeMinFQ()" parIsImportant="true">
<PARAM_HELP><![CDATA[The vertex are displaced of a vector whose norm is bounded by this value]]></PARAM_HELP>
<PARAM_HELP><![CDATA[The faces are displaced of a vector whose norm is bounded by this value]]></PARAM_HELP>
<EDIT_GUI guiLabel="Hist Min" />
</PARAM>
<PARAM parType="Real" parName="HistMax" parDefault="meshDoc.current().computeMaxFQ()" parIsImportant="true">
<PARAM_HELP><![CDATA[The vertex are displaced of a vector whose norm is bounded by this value]]></PARAM_HELP>
<PARAM_HELP><![CDATA[The faces are displaced of a vector whose norm is bounded by this value]]></PARAM_HELP>
<EDIT_GUI guiLabel="Hist Max" />
</PARAM>
<PARAM parName="areaWeighted" parIsImportant="true" parType="Boolean" parDefault="false">
<PARAM_HELP><![CDATA[If false, the histogram will report the number of faces with quality values
falling in each bin of the histogram. If true each bin of the histogram will report the approximate area
of the mesh with that range of values.]]></PARAM_HELP>
<CHECKBOX_GUI guiLabel="Area Weighted"/>
</PARAM>
<PARAM parType="Int" parName="binNum" parDefault="20" parIsImportant="true">
<PARAM_HELP><![CDATA[The number of bins of the histogram. E.g. the number of intervals in which the min..max range is subdivided into.]]></PARAM_HELP>
<EDIT_GUI guiLabel="Bin number" />