From 2c5017f67eb048d987d3a4212409a586631e37cc Mon Sep 17 00:00:00 2001 From: Jakub Kolman <kubokolman@gmail.com> Date: Thu, 28 Apr 2022 09:37:35 +0200 Subject: [PATCH] [#123] feat: visualisation of rotated featurepoints --- .../analyst/procrustes/ProcrustesAnalysis.java | 4 ++-- .../ProcrustesAnalysisFaceModel.java | 18 +++++++++++++++++- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/Comparison/src/main/java/cz/fidentis/analyst/procrustes/ProcrustesAnalysis.java b/Comparison/src/main/java/cz/fidentis/analyst/procrustes/ProcrustesAnalysis.java index 4ceb431a..f5c90f37 100644 --- a/Comparison/src/main/java/cz/fidentis/analyst/procrustes/ProcrustesAnalysis.java +++ b/Comparison/src/main/java/cz/fidentis/analyst/procrustes/ProcrustesAnalysis.java @@ -106,8 +106,8 @@ public class ProcrustesAnalysis { transformation.setRotationMatrix(this.rotate()); // move faces back to so the centroid of vertices is in the origin point -// moveFaceModel(faceModel1, new Vector3d(this.modelCentroid1.x, this.modelCentroid1.y, this.modelCentroid1.z)); -// moveFaceModel(faceModel2, new Vector3d(this.modelCentroid1.x, this.modelCentroid1.y, this.modelCentroid1.z)); + moveFaceModel(faceModel1, new Vector3d(this.modelCentroid1.x, this.modelCentroid1.y, this.modelCentroid1.z)); + moveFaceModel(faceModel2, new Vector3d(this.modelCentroid1.x, this.modelCentroid1.y, this.modelCentroid1.z)); // readjustFace(faceModel2, // new Vector3d(this.modelCentroid2.x, this.modelCentroid2.y, this.modelCentroid2.z), diff --git a/Comparison/src/main/java/cz/fidentis/analyst/procrustes/ProcrustesAnalysisFaceModel.java b/Comparison/src/main/java/cz/fidentis/analyst/procrustes/ProcrustesAnalysisFaceModel.java index 132ab67f..35be152d 100644 --- a/Comparison/src/main/java/cz/fidentis/analyst/procrustes/ProcrustesAnalysisFaceModel.java +++ b/Comparison/src/main/java/cz/fidentis/analyst/procrustes/ProcrustesAnalysisFaceModel.java @@ -52,7 +52,9 @@ public class ProcrustesAnalysisFaceModel { */ public void setFeaturePointsMap(HashMap<Integer, FeaturePoint> featurePointsMap) { this.featurePointsMap = featurePointsMap; - this.humanFace.setFeaturePoints(getFeaturePointValues()); + readjustFeaturePoints(featurePointsMap); + +// this.humanFace.setFeaturePoints(getFeaturePointValues()); } public MeshModel getMeshModel() { @@ -125,4 +127,18 @@ public class ProcrustesAnalysisFaceModel { return map; } + private void readjustFeaturePoints(HashMap<Integer, FeaturePoint> featurePointsMap) { + this.humanFace.getFeaturePoints().forEach(fp -> { + FeaturePoint movedFp = featurePointsMap.get(fp.getFeaturePointType().getType()); + if (fp.getFeaturePointType().getType() + != movedFp.getFeaturePointType().getType()) { + throw new RuntimeException("Types do not correspond"); + } + fp.getPosition().x = movedFp.getX(); + fp.getPosition().y = movedFp.getY(); + fp.getPosition().z = movedFp.getZ(); + }); +// throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + } + } -- GitLab