diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..11301d9 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +.idea +out +Nonrobust_Algorithms.iml diff --git a/src/main/Main.java b/src/main/Main.java new file mode 100644 index 0000000..8302cfe --- /dev/null +++ b/src/main/Main.java @@ -0,0 +1,79 @@ +package main; + +import javafx.application.Application; +import javafx.scene.Group; +import javafx.scene.Scene; +import javafx.scene.canvas.Canvas; +import javafx.scene.canvas.GraphicsContext; +import javafx.scene.layout.StackPane; +import javafx.scene.paint.Color; +import javafx.scene.shape.ArcType; +import javafx.scene.shape.Path; +import javafx.stage.Stage; + +/** + * Created by kristopherguzman on 11/2/16. + */ +public class Main extends Application { + + public static void main(String[] args) { + + launch(args); + + } + + public void start(Stage primaryStage) { + + primaryStage.setTitle("Test"); + Group root = new Group(); + Canvas canvas = new Canvas(800, 600); + root.getChildren().add(canvas); + GraphicsContext gc = canvas.getGraphicsContext2D(); + for(int i = 0; i <= 360; i+= 10) { + + gc.setLineWidth(5); + gc.beginPath(); + gc.moveTo(400, 300); + double x = 400 + (400 * Math.cos(Math.toRadians(i))); + double y = 300 + (300 * Math.sin(Math.toRadians(i))) - 50; + System.out.println("X: " + x + "Y: " + y + " i: " + i); + gc.lineTo(x,y); + gc.stroke(); + gc.closePath(); + + } + + for(int i = 5; i <= 360; i+= 10) { + + gc.setStroke(Color.GREEN); + gc.setLineWidth(3); + gc.beginPath(); + gc.moveTo(400, 300); + double x = 400 + (400 * Math.cos(Math.toRadians(i))); + double y = 300 + (300 * Math.sin(Math.toRadians(i))) - 50; + System.out.println("X: " + x + "Y: " + y + " i: " + i); + gc.lineTo(x,y); + gc.stroke(); + gc.closePath(); + + } + + for(double i = 2.5; i <= 360; i+= 5) { + + gc.setStroke(Color.RED); + gc.setLineWidth(2); + gc.beginPath(); + gc.moveTo(400, 300); + double x = 400 + (400 * Math.cos(Math.toRadians(i))); + double y = 300 + (300 * Math.sin(Math.toRadians(i))) - 50; + System.out.println("X: " + x + "Y: " + y + " i: " + i); + gc.lineTo(x,y); + gc.stroke(); + gc.closePath(); + + } + + primaryStage.setScene(new Scene(root)); + primaryStage.show(); + } +}