From ae0c974190dfe4c1087717fa9b67ac38d2a13ba9 Mon Sep 17 00:00:00 2001
From: Radek Oslejsek <oslejsek@fi.muni.cz>
Date: Thu, 22 Apr 2021 10:33:35 +0200
Subject: [PATCH] removed merge residues

---
 .../gui/ComparisonGLEventListener.java.orig   | 260 ------------------
 .../analyst/gui/TestInterface.java.orig       | 118 --------
 2 files changed, 378 deletions(-)
 delete mode 100644 GUI/src/main/java/cz/fidentis/analyst/gui/ComparisonGLEventListener.java.orig
 delete mode 100644 GUI/src/main/java/cz/fidentis/analyst/gui/TestInterface.java.orig

diff --git a/GUI/src/main/java/cz/fidentis/analyst/gui/ComparisonGLEventListener.java.orig b/GUI/src/main/java/cz/fidentis/analyst/gui/ComparisonGLEventListener.java.orig
deleted file mode 100644
index 5006bc40..00000000
--- a/GUI/src/main/java/cz/fidentis/analyst/gui/ComparisonGLEventListener.java.orig
+++ /dev/null
@@ -1,260 +0,0 @@
-package cz.fidentis.analyst.gui;
-
-import com.jogamp.opengl.GL;
-import com.jogamp.opengl.GL2;
-import com.jogamp.opengl.GLAutoDrawable;
-import cz.fidentis.analyst.face.HumanFace;
-import cz.fidentis.analyst.mesh.core.MeshFacet;
-import cz.fidentis.analyst.mesh.core.MeshModel;
-<<<<<<< HEAD
-import cz.fidentis.analyst.visitors.mesh.HausdorffDistance;
-=======
->>>>>>> e14874dcf3beefe67e672326e3f987e3e8966051
-
-import javax.vecmath.Vector3d;
-import java.awt.*;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import static com.jogamp.opengl.GL.GL_FRONT_AND_BACK;
-import static com.jogamp.opengl.GL.GL_VIEWPORT;
-import static com.jogamp.opengl.GL2GL3.GL_FILL;
-import static com.jogamp.opengl.GL2GL3.GL_LINE;
-import static com.jogamp.opengl.fixedfunc.GLMatrixFunc.GL_MODELVIEW_MATRIX;
-import static com.jogamp.opengl.fixedfunc.GLMatrixFunc.GL_PROJECTION_MATRIX;
-<<<<<<< HEAD
-
-/**
- *
- *  @author Daniel Sokol
- *
- *  Rendering face with heatmap.
- */
-public class ComparisonGLEventListener extends GeneralGLEventListener {
-    boolean renderHeatmap;
-    Color minColor;
-    Color maxColor;
-    private Map<MeshFacet, List<Double>> distances = new HashMap<>();
-    private HumanFace comparedFace;
-=======
-import cz.fidentis.analyst.visitors.mesh.Curvature;
-import cz.fidentis.analyst.visitors.mesh.HausdorffDistance;
-
-/**
- * 
- * @author radek oslejsek
- */
-public class ComparisonGLEventListener extends GeneralGLEventListener {
-    private Map<MeshFacet, List<Double>> distances = new HashMap<>();
-    private HumanFace comparedFace;
-    boolean renderHeatmap;
-    Color minColor;
-    Color maxColor;
-
->>>>>>> e14874dcf3beefe67e672326e3f987e3e8966051
-
-
-    public ComparisonGLEventListener(Canvas canvas) {
-        super(canvas);
-    }
-
-    public void setComparedFace(HumanFace inputComparedFace) {
-        if (inputComparedFace != null) {
-            comparedFace = inputComparedFace;
-        }
-        renderHeatmap = false;
-    }
-
-    public void compare(Color minColor, Color maxColor) {
-<<<<<<< HEAD
-        HausdorffDistance hVisitor = new HausdorffDistance(getModel(), HausdorffDistance.Strategy.POINT_TO_POINT, false, false);
-        comparedFace.getMeshModel().compute(hVisitor);
-        distances = hVisitor.getDistances();
-=======
-        //HausdorffDistance hVisitor = new HausdorffDistance(getModel(), HausdorffDistance.Strategy.POINT_TO_POINT, false, false);
-        //comparedFace.getMeshModel().compute(hVisitor);
-        //distances = hVisitor.getDistances();
-        Curvature visitor = new Curvature();
-        comparedFace.getMeshModel().compute(visitor);
-        distances = visitor.getGaussianCurvatures();
->>>>>>> e14874dcf3beefe67e672326e3f987e3e8966051
-        renderHeatmap = true;
-        this.minColor = minColor;
-        this.maxColor = maxColor;
-    }
-
-    @Override
-    public void display(GLAutoDrawable glad) {
-        wireModel = glCanvas.getDrawWired(); // is wire-frame or not
-
-        if (whiteBackround) {
-            gl.glClearColor(0.9f, 0.9f, 0.9f, 0);
-        } else {
-            gl.glClearColor(0.25f, 0.25f, 0.25f, 0);
-        }
-        // background for GLCanvas
-        gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
-        gl.glLoadIdentity();
-
-        // sets model to proper position
-        glu.gluLookAt(xCameraPosition, yCameraPosition, zCameraPosition, xCenter, yCenter, zCenter, xUpPosition, yUpPosition, zUpPosition);
-
-        gl.glShadeModel(GL2.GL_SMOOTH);
-        gl.glGetIntegerv(GL_VIEWPORT, viewport, 0);
-        gl.glGetFloatv(GL_MODELVIEW_MATRIX, modelViewMatrix, 0);
-        gl.glGetFloatv(GL_PROJECTION_MATRIX, projectionMatrix, 0);
-
-        //if there is any model, draw
-        if (comparedFace != null) {
-            if (renderHeatmap) {
-                drawHeatmap(comparedFace.getMeshModel());
-            } else {
-                drawWithoutTextures(comparedFace.getMeshModel());
-            }
-        } else if (getModel() != null) {
-            if (wireModel) {
-                gl.glPolygonMode(GL_FRONT_AND_BACK, GL_LINE); //drawn as wire-frame
-            } else {
-                gl.glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); // drawn as full traingles
-            }
-
-            drawWithoutTextures(getModel());
-        }
-
-        gl.glFlush();
-    }
-
-    public void drawHeatmap(MeshModel model) {
-        for (int i = 0; i < model.getFacets().size(); i++) {
-            List<Double> distanceList = distances.get(model.getFacets().get(i));
-            Double minDistance = distanceList.stream().mapToDouble(Double::doubleValue).min().getAsDouble();
-            Double maxDistance = distanceList.stream().mapToDouble(Double::doubleValue).max().getAsDouble();
-<<<<<<< HEAD
-=======
-            minDistance = -0.05; // !!!
-            maxDistance = 0.01; // !!!
-            //minDistance = -0.2; // !!! min
-            //maxDistance = 0.05; // !!! min
-            //System.out.println("AAA" + minDistance + " " + maxDistance);
->>>>>>> e14874dcf3beefe67e672326e3f987e3e8966051
-            renderFaceWithHeatmap(model.getFacets().get(i), distances.get(model.getFacets().get(i)), minDistance, maxDistance);
-        }
-    }
-
-    public void renderFaceWithHeatmap(MeshFacet facet, List<Double> distancesList, Double minDistance, Double maxDistance) {
-        gl.glBegin(GL2.GL_TRIANGLES); //vertices are rendered as triangles
-
-        // get the normal and tex coords indicies for face i
-        for (int v = 0; v < facet.getCornerTable().getSize(); v++) {
-            // render the normals
-            Vector3d norm = facet.getVertices().get(facet.getCornerTable().getRow(v).getVertexIndex()).getNormal();
-            if (norm != null) {
-                gl.glNormal3d(norm.x, norm.y, norm.z);
-            }
-            // render the vertices
-            Vector3d vert = facet.getVertices().get(facet.getCornerTable().getRow(v).getVertexIndex()).getPosition();
-            //get color of vertex
-            Color c = getColor(distancesList.get(facet.getCornerTable().getRow(v).getVertexIndex()), minDistance, maxDistance);
-            gl.glMaterialfv(GL2.GL_FRONT_AND_BACK, GL2.GL_DIFFUSE, c.getComponents(null), 0);
-
-            gl.glVertex3d(vert.x, vert.y, vert.z);
-        }
-        gl.glEnd();
-        gl.glPopAttrib();
-    }
-
-    Color getColor(Double currentDistance, Double minDistance, Double maxDistance) {
-        double currentParameter = ((currentDistance - minDistance) / (maxDistance - minDistance));
-<<<<<<< HEAD
-
-        float[] hsb1 = Color.RGBtoHSB(minColor.getRed(), minColor.getGreen(), minColor.getBlue(), null);
-        float h1 = hsb1[0];
-        float s1 = hsb1[1];
-        float b1 = hsb1[2];
-
-        float[] hsb2 = Color.RGBtoHSB(maxColor.getRed(), maxColor.getGreen(), maxColor.getBlue(), null);
-        float h2 = hsb2[0];
-        float s2 = hsb2[1];
-        float b2 = hsb2[2];
-
-        // determine clockwise and counter-clockwise distance between hues
-        float distCCW;
-        float distCW;
-=======
-        //return new Color((float)currentParameter, 0.5f, 0.5f);
-        
-        if (currentDistance > maxDistance || currentDistance < minDistance) { // !!!
-            currentParameter = 1.0;
-        }
-        //currentParameter *= 10;
-        //if (currentParameter > maxDistance) {
-        //    currentParameter = 1.0;
-        //}
-        //System.out.println("AAA " + currentParameter + " " + minDistance + " " + maxDistance);
-        
-        float[] hsb1 = Color.RGBtoHSB(minColor.getRed(), minColor.getGreen(), minColor.getBlue(), null);
-        double h1 = hsb1[0];
-        double s1 = hsb1[1];
-        double b1 = hsb1[2];
-
-        float[] hsb2 = Color.RGBtoHSB(maxColor.getRed(), maxColor.getGreen(), maxColor.getBlue(), null);
-        double h2 = hsb2[0];
-        double s2 = hsb2[1];
-        double b2 = hsb2[2];
-
-        // determine clockwise and counter-clockwise distance between hues
-        double distCCW;
-        double distCW;
->>>>>>> e14874dcf3beefe67e672326e3f987e3e8966051
-
-        if (h1 >= h2) {
-            distCCW = h1 - h2;
-            distCW = 1 + h2 - h1;
-        } else {
-            distCCW = 1 + h1 - h2;
-            distCW = h2 - h1;
-        }
-
-<<<<<<< HEAD
-        float hue;
-
-        if (distCW >= distCCW) {
-            hue = (float) (h1 + (distCW * currentParameter));
-        } else {
-            hue = (float) (h1 - (distCCW * currentParameter));
-=======
-        double hue;
-
-        if (distCW >= distCCW) {
-            hue = h1 + (distCW * currentParameter);
-        } else {
-            hue = h1 - (distCCW * currentParameter);
->>>>>>> e14874dcf3beefe67e672326e3f987e3e8966051
-        }
-
-        if (hue < 0) {
-            hue = 1 + hue;
-        }
-        if (hue > 1) {
-            hue = hue - 1;
-        }
-<<<<<<< HEAD
-
-        float saturation = (float) ((1 - currentParameter) * s1 + currentParameter * s2);
-        float brightness = (float) ((1 - currentParameter) * b1 + currentParameter * b2);
-
-        return Color.getHSBColor(hue, saturation, brightness);
-    }
-}
-=======
-        
-        double saturation = (1 - currentParameter) * s1 + currentParameter * s2;
-        double brightness = (1 - currentParameter) * b1 + currentParameter * b2;
-
-        //System.out.println("AAA " + hue);
-
-        return Color.getHSBColor((float)hue, (float)saturation, (float)brightness);
-    }
-}
->>>>>>> e14874dcf3beefe67e672326e3f987e3e8966051
diff --git a/GUI/src/main/java/cz/fidentis/analyst/gui/TestInterface.java.orig b/GUI/src/main/java/cz/fidentis/analyst/gui/TestInterface.java.orig
deleted file mode 100644
index cc2745f6..00000000
--- a/GUI/src/main/java/cz/fidentis/analyst/gui/TestInterface.java.orig
+++ /dev/null
@@ -1,118 +0,0 @@
-package cz.fidentis.analyst.gui;
-
-import cz.fidentis.analyst.face.HumanFace;
-import cz.fidentis.analyst.mesh.io.ModelFileFilter;
-
-import javax.swing.*;
-import java.awt.*;
-import java.io.File;
-import java.io.IOException;
-
-<<<<<<< HEAD
-/**
- * @author Daniel Sokol
- * <p>
- * Temporary interface to test rendering heatmap.
- */
-
-
-=======
->>>>>>> e14874dcf3beefe67e672326e3f987e3e8966051
-public class TestInterface {
-    private static final JFrame testFrame = new JFrame();
-    private static HumanFace comparedModel;
-
-    public static void main(String[] args) {
-
-<<<<<<< HEAD
-=======
-        //Declaration
->>>>>>> e14874dcf3beefe67e672326e3f987e3e8966051
-        JButton addButton = new JButton("Load face to compare");
-        JButton compareButton = new JButton("Show differences");
-
-        Canvas testCanvas = new Canvas();
-        ComparisonGLEventListener colorListener = new ComparisonGLEventListener(testCanvas);
-        testCanvas.setListener(colorListener);
-        JColorChooser colorChooserMin = new JColorChooser(Color.BLUE);
-        JColorChooser colorChooserMax = new JColorChooser(Color.RED);
-
-        JButton color1 = new JButton("Pick color for smallest distances");
-        JFrame colorMinFrame = new JFrame();
-        colorMinFrame.add(colorChooserMin);
-        colorMinFrame.pack();
-
-        JButton color2 = new JButton("Pick color for largest distances");
-        JFrame colorMaxFrame = new JFrame();
-        colorMaxFrame.add(colorChooserMax);
-        colorMaxFrame.pack();
-
-<<<<<<< HEAD
-=======
-        // Settings
->>>>>>> e14874dcf3beefe67e672326e3f987e3e8966051
-        addButton.addActionListener(e -> {
-                    try {
-                        JFileChooser jFileChooser1 = new JFileChooser();
-                        jFileChooser1.setPreferredSize(new Dimension(800, 500));
-                        jFileChooser1.addChoosableFileFilter(new ModelFileFilter(new String[]{"obj", "OBJ"}, "*.obj"));
-                        jFileChooser1.showOpenDialog(testFrame);
-                        if (jFileChooser1.getSelectedFile() == null) {
-                            System.out.print("No file chosen.");
-                        } else {
-                            comparedModel = new HumanFace(new File(jFileChooser1.getSelectedFile().getPath()));
-                            colorListener.setComparedFace(comparedModel);
-                            addButton.setBackground(new Color(50, 200, 20));
-
-                        }
-                    } catch (IOException ioException) {
-                        ioException.printStackTrace();
-                    }
-                }
-        );
-
-        compareButton.addActionListener(e -> colorListener.compare(colorChooserMin.getColor(), colorChooserMax.getColor()));
-
-        color1.addActionListener(e -> colorMinFrame.setVisible(true));
-
-        color2.addActionListener(e -> colorMaxFrame.setVisible(true));
-
-        testFrame.setLayout(new GridBagLayout());
-        testFrame.setVisible(true);
-        testFrame.setSize(1200, 700);
-
-<<<<<<< HEAD
-=======
-        // Adding
->>>>>>> e14874dcf3beefe67e672326e3f987e3e8966051
-        GridBagConstraints c = new GridBagConstraints();
-        c.fill = GridBagConstraints.BOTH;
-        c.gridx = 0;
-        c.gridy = 0;
-        c.weighty = 1;
-        c.weightx = 1;
-
-        c.gridheight = 6;
-        c.gridwidth = 4;
-        c.weightx = 4;
-        testFrame.add(testCanvas, c);
-        c.gridheight = 1;
-        c.gridwidth = 2;
-        c.gridx = 4;
-        c.weightx = 2;
-        testFrame.add(addButton, c);
-        c.gridy = 1;
-        testFrame.add(compareButton, c);
-        c.gridy = 2;
-        c.gridwidth = 1;
-        c.weightx = 1;
-        testFrame.add(color1, c);
-        c.gridx = 5;
-        testFrame.add(color2, c);
-
-    }
-}
-<<<<<<< HEAD
-
-=======
->>>>>>> e14874dcf3beefe67e672326e3f987e3e8966051
-- 
GitLab