Loading Comparison/src/main/java/cz/fidentis/analyst/Project.java +3 −32 Original line number Diff line number Diff line package cz.fidentis.analyst; import cz.fidentis.analyst.face.HumanFace; import cz.fidentis.analyst.mesh.events.MeshEvent; import java.util.ArrayList; import java.util.Collections; import java.util.List; /** * This class encapsulates data for a "comparison project", i.e., a project * enabling analysts to compare and investigate human faces. Loading @@ -16,37 +18,6 @@ public class Project { //private HumanFace primaryFace; private List<HumanFace> faces = new ArrayList<>(); /** * Returns primary face * * @return HumanFace primary face public HumanFace getPrimaryFace() { return primaryFace; } /** * Sets new primary face * * @param primaryFace which will be new primary face * @throws IllegalArgumentException when argument primaryFace is null public void setPrimaryFace(HumanFace primaryFace) { if (primaryFace == null) { throw new IllegalArgumentException("Primary face is null"); } this.primaryFace = primaryFace; } /** * Removes primary face and sets primaryFace attribute to null public void removePrimaryFace() { this.primaryFace = null; }*/ /** * Returns list of HumanFace secondary faces * Loading Comparison/src/main/java/cz/fidentis/analyst/face/HumanFace.java +14 −1 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ import java.util.Collections; import java.util.List; import java.util.ArrayList; import java.util.Objects; import java.util.Observable; //import org.nustaq.serialization.FSTConfiguration; //import org.nustaq.serialization.FSTObjectInput; //import org.nustaq.serialization.FSTObjectOutput; Loading @@ -50,7 +51,7 @@ import java.util.Objects; * * @author Radek Oslejsek */ public class HumanFace implements MeshListener, Serializable { public class HumanFace extends Observable implements MeshListener, Serializable { private MeshModel meshModel; Loading Loading @@ -116,6 +117,8 @@ public class HumanFace implements MeshListener, Serializable { */ public void registerListener(MeshListener listener) { eventBus.register(listener); setChanged(); notifyObservers(this); } /** Loading @@ -125,6 +128,8 @@ public class HumanFace implements MeshListener, Serializable { */ public void unregisterListener(MeshListener listener) { eventBus.unregister(listener); setChanged(); notifyObservers(this); } /** Loading Loading @@ -182,6 +187,8 @@ public class HumanFace implements MeshListener, Serializable { */ public void setFeaturePoints(List<FeaturePoint> points) { featurePoints = points; setChanged(); notifyObservers(this); } /** Loading @@ -193,6 +200,8 @@ public class HumanFace implements MeshListener, Serializable { */ public void loadFeaturePoints(String path, String fileName) throws IOException { featurePoints = FeaturePointImportService.importFeaturePoints(path, fileName); setChanged(); notifyObservers(this); } /** Loading Loading @@ -253,6 +262,8 @@ public class HumanFace implements MeshListener, Serializable { public KdTree computeKdTree(boolean recompute) { if (kdTree == null || recompute) { kdTree = new KdTree(new ArrayList<>(meshModel.getFacets())); setChanged(); notifyObservers(this); } return kdTree; } Loading @@ -264,6 +275,8 @@ public class HumanFace implements MeshListener, Serializable { public KdTree removeKdTree() { KdTree ret = this.kdTree; this.kdTree = null; setChanged(); notifyObservers(this); return ret; } Loading Comparison/src/main/java/cz/fidentis/analyst/icp/RandomStrategy.java +1 −1 Original line number Diff line number Diff line Loading @@ -18,7 +18,7 @@ public class RandomStrategy extends UndersamplingStrategy { /** * Constructor for PERCENTAGE undersampling type. * * @param perc Percentage - a value in (0.0, 1.0>l * @param perc Percentage - a value in (0.0, 1.0> * @throws IllegalArgumentException if the input parameter is wrong */ public RandomStrategy(double perc) { Loading Comparison/src/main/java/cz/fidentis/analyst/visitors/mesh/CrossSection.java 0 → 100644 +59 −0 Original line number Diff line number Diff line package cz.fidentis.analyst.visitors.mesh; import cz.fidentis.analyst.mesh.MeshVisitor; import cz.fidentis.analyst.mesh.core.MeshFacet; import cz.fidentis.analyst.mesh.core.MeshTriangle; import javax.vecmath.Point3d; import java.util.ArrayList; import java.util.List; /** * A visitor that calculates the cross-section of a face and a cutting plane. * <p> * This visitor is thread-safe. * </p> * * @author Dominik Racek */ public class CrossSection extends MeshVisitor { private List<Point3d> points; private MeshFacet plane; /** * Constructor * @param plane the cutting plane */ public CrossSection(MeshFacet plane) { this.plane = plane; this.points = new ArrayList<>(); } @Override public void visitMeshFacet(MeshFacet facet) { //TODO Dont check every triangle, find first and then check it's neighbors and new neighbors and so on synchronized (this) { Point3d last = null; for (MeshTriangle tri : facet) { if (tri.checkIntersectionWithPlane(plane)) { Point3d p = tri.getVertex1(); // Check for duplicates if (last != null) { if (last == p) { continue; } } points.add(p); last = p; } } } } public List<Point3d> getPoints() { return points; } } GUI/src/main/java/cz/fidentis/analyst/core/ControlPanelBuilder.java +18 −0 Original line number Diff line number Diff line package cz.fidentis.analyst.core; import cz.fidentis.analyst.symmetry.PolylinePanel; import java.awt.Color; import java.awt.Font; import java.awt.GridBagConstraints; Loading Loading @@ -729,4 +731,20 @@ public class ControlPanelBuilder { return scrollPane; } /** * Adds a polyline panel with profile curves * * @param panel Panel to be added */ public void addPolylinePanel(PolylinePanel panel) { GridBagConstraints c = new GridBagConstraints(); c.gridwidth = GridBagConstraints.RELATIVE; c.gridy = row; c.gridx = col; c.insets = new Insets(10, 10, 0, 0); controlPanel.add(panel, c); } } Loading
Comparison/src/main/java/cz/fidentis/analyst/Project.java +3 −32 Original line number Diff line number Diff line package cz.fidentis.analyst; import cz.fidentis.analyst.face.HumanFace; import cz.fidentis.analyst.mesh.events.MeshEvent; import java.util.ArrayList; import java.util.Collections; import java.util.List; /** * This class encapsulates data for a "comparison project", i.e., a project * enabling analysts to compare and investigate human faces. Loading @@ -16,37 +18,6 @@ public class Project { //private HumanFace primaryFace; private List<HumanFace> faces = new ArrayList<>(); /** * Returns primary face * * @return HumanFace primary face public HumanFace getPrimaryFace() { return primaryFace; } /** * Sets new primary face * * @param primaryFace which will be new primary face * @throws IllegalArgumentException when argument primaryFace is null public void setPrimaryFace(HumanFace primaryFace) { if (primaryFace == null) { throw new IllegalArgumentException("Primary face is null"); } this.primaryFace = primaryFace; } /** * Removes primary face and sets primaryFace attribute to null public void removePrimaryFace() { this.primaryFace = null; }*/ /** * Returns list of HumanFace secondary faces * Loading
Comparison/src/main/java/cz/fidentis/analyst/face/HumanFace.java +14 −1 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ import java.util.Collections; import java.util.List; import java.util.ArrayList; import java.util.Objects; import java.util.Observable; //import org.nustaq.serialization.FSTConfiguration; //import org.nustaq.serialization.FSTObjectInput; //import org.nustaq.serialization.FSTObjectOutput; Loading @@ -50,7 +51,7 @@ import java.util.Objects; * * @author Radek Oslejsek */ public class HumanFace implements MeshListener, Serializable { public class HumanFace extends Observable implements MeshListener, Serializable { private MeshModel meshModel; Loading Loading @@ -116,6 +117,8 @@ public class HumanFace implements MeshListener, Serializable { */ public void registerListener(MeshListener listener) { eventBus.register(listener); setChanged(); notifyObservers(this); } /** Loading @@ -125,6 +128,8 @@ public class HumanFace implements MeshListener, Serializable { */ public void unregisterListener(MeshListener listener) { eventBus.unregister(listener); setChanged(); notifyObservers(this); } /** Loading Loading @@ -182,6 +187,8 @@ public class HumanFace implements MeshListener, Serializable { */ public void setFeaturePoints(List<FeaturePoint> points) { featurePoints = points; setChanged(); notifyObservers(this); } /** Loading @@ -193,6 +200,8 @@ public class HumanFace implements MeshListener, Serializable { */ public void loadFeaturePoints(String path, String fileName) throws IOException { featurePoints = FeaturePointImportService.importFeaturePoints(path, fileName); setChanged(); notifyObservers(this); } /** Loading Loading @@ -253,6 +262,8 @@ public class HumanFace implements MeshListener, Serializable { public KdTree computeKdTree(boolean recompute) { if (kdTree == null || recompute) { kdTree = new KdTree(new ArrayList<>(meshModel.getFacets())); setChanged(); notifyObservers(this); } return kdTree; } Loading @@ -264,6 +275,8 @@ public class HumanFace implements MeshListener, Serializable { public KdTree removeKdTree() { KdTree ret = this.kdTree; this.kdTree = null; setChanged(); notifyObservers(this); return ret; } Loading
Comparison/src/main/java/cz/fidentis/analyst/icp/RandomStrategy.java +1 −1 Original line number Diff line number Diff line Loading @@ -18,7 +18,7 @@ public class RandomStrategy extends UndersamplingStrategy { /** * Constructor for PERCENTAGE undersampling type. * * @param perc Percentage - a value in (0.0, 1.0>l * @param perc Percentage - a value in (0.0, 1.0> * @throws IllegalArgumentException if the input parameter is wrong */ public RandomStrategy(double perc) { Loading
Comparison/src/main/java/cz/fidentis/analyst/visitors/mesh/CrossSection.java 0 → 100644 +59 −0 Original line number Diff line number Diff line package cz.fidentis.analyst.visitors.mesh; import cz.fidentis.analyst.mesh.MeshVisitor; import cz.fidentis.analyst.mesh.core.MeshFacet; import cz.fidentis.analyst.mesh.core.MeshTriangle; import javax.vecmath.Point3d; import java.util.ArrayList; import java.util.List; /** * A visitor that calculates the cross-section of a face and a cutting plane. * <p> * This visitor is thread-safe. * </p> * * @author Dominik Racek */ public class CrossSection extends MeshVisitor { private List<Point3d> points; private MeshFacet plane; /** * Constructor * @param plane the cutting plane */ public CrossSection(MeshFacet plane) { this.plane = plane; this.points = new ArrayList<>(); } @Override public void visitMeshFacet(MeshFacet facet) { //TODO Dont check every triangle, find first and then check it's neighbors and new neighbors and so on synchronized (this) { Point3d last = null; for (MeshTriangle tri : facet) { if (tri.checkIntersectionWithPlane(plane)) { Point3d p = tri.getVertex1(); // Check for duplicates if (last != null) { if (last == p) { continue; } } points.add(p); last = p; } } } } public List<Point3d> getPoints() { return points; } }
GUI/src/main/java/cz/fidentis/analyst/core/ControlPanelBuilder.java +18 −0 Original line number Diff line number Diff line package cz.fidentis.analyst.core; import cz.fidentis.analyst.symmetry.PolylinePanel; import java.awt.Color; import java.awt.Font; import java.awt.GridBagConstraints; Loading Loading @@ -729,4 +731,20 @@ public class ControlPanelBuilder { return scrollPane; } /** * Adds a polyline panel with profile curves * * @param panel Panel to be added */ public void addPolylinePanel(PolylinePanel panel) { GridBagConstraints c = new GridBagConstraints(); c.gridwidth = GridBagConstraints.RELATIVE; c.gridy = row; c.gridx = col; c.insets = new Insets(10, 10, 0, 0); controlPanel.add(panel, c); } }