From d5603c0a179ec508c773deadbf8bdbe11e11d151 Mon Sep 17 00:00:00 2001
From: Daniel Schramm <xschramm@fi.muni.cz>
Date: Mon, 22 Mar 2021 17:27:37 +0100
Subject: [PATCH] KdTree commented code removed

---
 .../cz/fidentis/analyst/kdtree/KdTree.java    | 147 ------------------
 1 file changed, 147 deletions(-)

diff --git a/MeshModel/src/main/java/cz/fidentis/analyst/kdtree/KdTree.java b/MeshModel/src/main/java/cz/fidentis/analyst/kdtree/KdTree.java
index fb94a7cf..d3568c0a 100644
--- a/MeshModel/src/main/java/cz/fidentis/analyst/kdtree/KdTree.java
+++ b/MeshModel/src/main/java/cz/fidentis/analyst/kdtree/KdTree.java
@@ -112,118 +112,6 @@ public class KdTree {
     public KdNode getRoot() {
         return root;
     }
-    
-    /**
-     * Finds the closest node for given mesh point.
-     *
-     * @param p Mesh point to be searched
-     * @return the closest node of the kd-tree or null
-     */
-    /*
-    public KdNode closestNode(MeshPoint p) {
-        if (p == null) {
-            return null;
-        }
-        return closestNode(p.getPosition());
-    }
-    */
-
-    /**
-     * Finds the closest node for given 3D location.
-     *
-     * @param pointPos 3D location
-     * @return the closest node of the kd-tree or null
-     */
-    /*
-    public KdNode closestNode(Vector3d pointPos) {
-        if (pointPos == null || this.root == null) {
-            return null;
-        }
-        
-        // First, find the closest node
-        double minDistance = Double.POSITIVE_INFINITY;
-        KdNode nearNode = root;
-        KdNode searchedNode = root;
-
-        while (searchedNode != null) {
-            Vector3d nodePos = searchedNode.getLocation();
-            double dist = MeshPoint.distance(pointPos, nodePos);
-            if(dist < minDistance){
-                nearNode = searchedNode;
-                minDistance = dist;
-            }
-
-            if (firstIsLessThanSecond(pointPos, nodePos, searchedNode.getDepth())) {
-                searchedNode = searchedNode.getLesser();
-            }else{
-                searchedNode = searchedNode.getGreater();
-            }
-        }
-
-         // Second, search for a vertex that could be potentially closer than
-         // the nearest vertex already found
-        double distOnAxis;
-        Queue<KdNode> queue = new LinkedList<>();
-        queue.add(root);
-
-        while (!queue.isEmpty()) {
-            
-            if (minDistance == 0) { // nothing can be closer
-                break;
-            }
-
-            searchedNode = queue.poll();
-            Vector3d nodePos = searchedNode.getLocation();
-
-            double dist = MeshPoint.distance(pointPos, nodePos);
-            if (dist < minDistance) {
-                nearNode = searchedNode;
-                minDistance = dist;
-            }
-
-            distOnAxis = minDistanceIntersection(nodePos, pointPos, searchedNode.getDepth());
-
-            if (distOnAxis > minDistance) {
-                if (firstIsLessThanSecond(pointPos, nodePos, searchedNode.getDepth())) {
-                    if (searchedNode.getLesser() != null) {
-                        queue.add(searchedNode.getLesser());
-                    }
-                } else {
-                    if (searchedNode.getGreater() != null) {
-                        queue.add(searchedNode.getGreater());
-                    }
-                }
-            } else {
-                if (searchedNode.getLesser() != null) {
-                    queue.add(searchedNode.getLesser());
-                }
-                if (searchedNode.getGreater() != null) {
-                    queue.add(searchedNode.getGreater());
-                }
-            }
-        }
-
-        return nearNode;
-    }
-    */
-
-    /**
-     * Checks if the kd-tree includes a node with 3D location corresponsding 
-     * to the given mesh point.
-     * 
-     * @param p Point whose location is searched
-     * @return true if there is node covering the same 3D location, false otherwise.
-     * @throws NullPointerException if the input parameter is null or has no position set
-     */
-    /*
-    public boolean containsPoint(MeshPoint p){
-        KdNode node = closestNode(p);
-        if (node == null) {
-            return false;
-        }
-        return p.getPosition().equals(node.getLocation());
-    }
-    */
 
     @Override
     public String toString() {
@@ -368,41 +256,6 @@ public class KdTree {
                 return v1.z == v2.z;
         }
     }
-    
-    /*
-    private boolean firstIsLessThanSecond(Vector3d v1, Vector3d v2, int level){
-        switch (level % 3) {
-            case 0:
-                return v1.x <= v2.x;
-            case 1:
-                return v1.y <= v2.y;
-            case 2:
-                return v1.z <= v2.z;
-            default:
-                break;
-        }
-        return false;
-    }
-    */
-    
-    /**
-     * Calculates distance between two points
-     * (currently searched node and point to which we want to find nearest neighbor)
-     * (based on axis)
-     *
-     */
-    /*
-    private double minDistanceIntersection(Vector3d nodePosition, Vector3d pointPosition, int level){
-        switch (level % 3) {
-            case 0:
-                return Math.abs(nodePosition.x - pointPosition.x);
-            case 1:
-                return Math.abs(nodePosition.y - pointPosition.y);
-            default:
-                return Math.abs(nodePosition.z - pointPosition.z);
-        }
-    }
-    */
    
     
     /***********************************************************
-- 
GitLab