Skip to content

Commit

Permalink
delete unused variables
Browse files Browse the repository at this point in the history
  • Loading branch information
johnprif committed Feb 18, 2023
1 parent b5c6b33 commit 595ca78
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 58 deletions.
3 changes: 0 additions & 3 deletions src/Control/InfoButtonHandler.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package Control;

import java.net.URL;

import Model.TextHandler;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
Expand All @@ -13,14 +12,12 @@
import javafx.scene.image.ImageView;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;
import javafx.scene.web.WebView;
import javafx.stage.Modality;
import javafx.stage.Stage;

public class InfoButtonHandler implements EventHandler<ActionEvent>
{
private Stage stage;
private WebView userManualView;
private VBox layout;
private Scene scene;
private Label label;
Expand Down
3 changes: 1 addition & 2 deletions src/Control/InfoContentHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;

import javafx.event.EventHandler;
import javafx.scene.input.MouseEvent;

public class InfoContentHandler implements EventHandler<MouseEvent>
{
private String paperURL = "https://github.com/johnprif/Thesis";
private String paperURL = "https://github.com/johnprif/Thesis";

@Override
public void handle(MouseEvent arg0)
Expand Down
45 changes: 3 additions & 42 deletions src/Model/DataBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ private double getAngle(Point2D p, Point2D q, Point2D r)
return Math.acos((a + b - c) / Math.sqrt(4 * a * b));
}

public Point2D getUp8(Point2D p)
private Point2D Up(Point2D p)
{
Point2D nextP = neighbours.get(p).get(1); //O(1)
double mx = (p.getX() + nextP.getX()) / 2.0;
Expand All @@ -447,45 +447,6 @@ public Point2D getUp8(Point2D p)
double uy = my + dy/5.0;
return new Point2D(ux, uy);
}

public Point2D getUp(Point2D p)
{
Point2D nextP = neighbours.get(p).get(1); //O(1)
Point2D nextNextP = neighbours.get(nextP).get(1);
double mx = (p.getX() + nextP.getX()) / 2.0;
double my = (p.getY() + nextP.getY()) / 2.0;
double slope = (nextP.getY()-p.getY())/(nextP.getX()-p.getX());
double invSlope = -1/slope;
//y-my = invSlope*(x-mx)
//y = invSlope*(x-mx)+my;
//find farthest point
double maxRadius = getRadius(p, nextP, nextNextP);
// define the distance to travel
double d = maxRadius/1000.0;
// calculate the change in x-coordinate
double dx = Math.sqrt(d * d / (1 + invSlope * invSlope));
if (invSlope < 0)
{
dx = -dx;
}
// calculate the change in y-coordinate
double dy = invSlope * dx;

// calculate the new coordinates of the point
double x2 = mx + dx;
double y2 = my + dy;
Point2D Up = new Point2D(x2, y2);

// return Up;
if(mode == 1)
{
return getUp8(p);
}else
{
return getUp8(p);
}

}

public boolean isPointInCircle(Point2D point, Point2D center, double radius)
{
Expand All @@ -508,7 +469,7 @@ public void addAllUpToK()
for (int i = 0; i < size; i++)
{
Point2D curr = convexPoints.get(i); //O(1)
Point2D Ucurr = getUp8(curr);
Point2D Ucurr = Up(curr);
u_p.put(curr, Ucurr);
K.add(Ucurr);
}
Expand All @@ -528,7 +489,7 @@ public void addCandUtoE(Point2D c, Point2D up)

}

public Point2D getUp2(Point2D p)
public Point2D getUp(Point2D p)
{
return u_p.get(p);
}
Expand Down
10 changes: 5 additions & 5 deletions src/Model/NeighborVoronoiDiagram.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ public void computeVoronoiDiagram()
next_p = dataBase.getNext();
c = dataBase.getCenter(before_p, p, next_p);
dataBase.addCtoK(c);
dataBase.addCandUtoE(c, dataBase.getUp2(p));
dataBase.addCandUtoE(c, dataBase.getUp2(before_p));
dataBase.addCandUtoE(c, dataBase.getUp(p));
dataBase.addCandUtoE(c, dataBase.getUp(before_p));
//u(q)=c;
dataBase.updateUp(before_p, c);
dataBase.deleteMaxP();
n = n-1;
}while(n != 2);
// dataBase.addCandUtoE(dataBase.getUp2(before_p), dataBase.getUp2(next_p));
dataBase.addCandUtoE(c, dataBase.getUp2(next_p));
dataBase.addCandUtoE(c, dataBase.getUp(next_p));
}else
{
System.out.println("Algorithm 2 started with = " + n);
Expand All @@ -52,8 +52,8 @@ public void computeVoronoiDiagram()
Point2D p1 = dataBase.getConvexPoints().get(0);
Point2D p2 = dataBase.getConvexPoints().get(1);

Point2D u_p1 = dataBase.getUp2(p1);
Point2D u_p2 = dataBase.getUp2(p2);
Point2D u_p1 = dataBase.getUp(p1);
Point2D u_p2 = dataBase.getUp(p2);

//add (u(p1), u(p2)) to E;
dataBase.addCandUtoE(u_p1, u_p2);
Expand Down
6 changes: 2 additions & 4 deletions src/View/MainGUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,7 @@ private void createAndSetHandlers()
exitButton.setOnAction(new ExitButtonHandler(stage));
infoButton.setOnAction(new InfoButtonHandler());
}



private void createButtons()
{
changeLanguageButton = new Button();
Expand Down Expand Up @@ -134,8 +133,7 @@ private void createMainPane()
borderPane.setBottom(infoButton);
borderPane.setAlignment(infoButton, Pos.CENTER_RIGHT);
}



private void createPaperTitle()
{
paperTitle = new Label();
Expand Down
2 changes: 0 additions & 2 deletions src/View/SmallestEnclosingCircleGraphGUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -189,11 +189,9 @@ private JFreeChart makeChart()
{
JFreeChart chart = new JFreeChart(plot);
chart.setTitle(title);
//=======================================================
chart.getTitle().setPaint(Color.decode("#006699"));
chart.getTitle().setFont(new Font("Arial", Font.TRUETYPE_FONT, 24));
chart.setBackgroundPaint(Color.decode("#f0f9f6"));
//=======================================================
chart.addSubtitle(textSubTitle);
chart.setElementHinting(true);
chart.setTextAntiAlias(true);
Expand Down

0 comments on commit 595ca78

Please sign in to comment.