Skip to content
Snippets Groups Projects
Commit 6a15d1ef authored by Daniel Schramm's avatar Daniel Schramm
Browse files

Computation of weighted Hausdorff distance implemented

parent e529f21f
No related branches found
No related tags found
No related merge requests found
......@@ -15,6 +15,8 @@ import java.util.DoubleSummaryStatistics;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
import javax.swing.JComboBox;
import javax.swing.JTabbedPane;
import javax.swing.JTextField;
......@@ -163,11 +165,28 @@ public class DistanceAction extends ControlPanelAction {
}
private Map<MeshFacet, List<Double>> calculateHausdorffDistance() {
if (weightedDist) {
// TODO Merge the map of distances with the map of priorities
if (!weightedDist) {
return visitor.getDistances();
}
return visitor.getDistances();
// Merge the map of distances with the map of priorities
final Map<MeshFacet, List<Double>> weightedDistances = new HashMap<>(visitor.getDistances());
final Map<MeshFacet, List<Double>> mergedPriorities = visitor.getMergedPriorities()
.get(getSecondaryDrawableFace().getHumanFace());
for (final Map.Entry<MeshFacet, List<Double>> facetPriorities: mergedPriorities.entrySet()) {
weightedDistances.merge(
facetPriorities.getKey(),
facetPriorities.getValue(),
(distancesList, prioritiesList) ->
IntStream.range(0, distancesList.size())
.mapToDouble(i -> distancesList.get(i) * prioritiesList.get(i))
.boxed()
.collect(Collectors.toList())
);
}
return weightedDistances;
}
private void highlightFeaturePoint(LoadedActionEvent actionEvent) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment