Skip to content

Commit

Permalink
tech test
Browse files Browse the repository at this point in the history
  • Loading branch information
Kristopher Guzman committed Nov 8, 2016
0 parents commit bb8aa0e
Show file tree
Hide file tree
Showing 2 changed files with 82 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.idea
out
Nonrobust_Algorithms.iml
79 changes: 79 additions & 0 deletions src/main/Main.java
Original file line number Diff line number Diff line change
@@ -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();
}
}

0 comments on commit bb8aa0e

Please sign in to comment.