Skip to content
Snippets Groups Projects
Commit 3f6bf1f0 authored by Magnus Eik's avatar Magnus Eik
Browse files

Increase ImageView resolution, use Blackboard transformation files

parent 668cb3df
No related branches found
No related tags found
No related merge requests found
......@@ -91,11 +91,9 @@ public class ChaosCanvas {
int yIndex = (int) transformCoordsToIndices.transform(point).getX1() + yOffset;
if (xIndex >= 0 && xIndex < width && yIndex >= 0 && yIndex < height) {
canvas[xIndex][yIndex] = 1;
} else {
System.out.println("Index out of bounds: " + xIndex + ", " + yIndex);
canvas[xIndex][yIndex] = 1;
}
}
}
/**
* Get the canvas array.
......
......@@ -40,18 +40,21 @@ public class ChaosGameGUIView {
public ChaosGameGUIView(Stage primaryStage) throws IOException {
this.timeline = new Timeline(new KeyFrame(Duration.seconds(0.05), event -> this.drawChaosGame()));
this.timeline = new Timeline(new KeyFrame(Duration.seconds(2), event -> this.drawChaosGame()));
imageView = new ImageView();
width = 1000;
height = 1000;
width = 10000;
height = 10000;
WritableImage writableImage = new WritableImage(width, height);
pixelWriter = writableImage.getPixelWriter();
imageView.setImage(writableImage);
imageView.setFitHeight(1000);
imageView.setFitWidth(1000);
VBox sideMenu = new VBox();
......@@ -59,11 +62,11 @@ public class ChaosGameGUIView {
ChaosGameDescriptionFactory factory = new ChaosGameDescriptionFactory();
AtomicReference<ChaosGameDescription> description = new AtomicReference<>(factory.getDescriptions().get(0));
ChaosCanvas canvas = new ChaosCanvas(1000, 1000, description.get().getMinCoords(), description.get().getMaxCoords());
ChaosCanvas canvas = new ChaosCanvas(10000, 10000, description.get().getMinCoords(), description.get().getMaxCoords());
game = new ChaosGame(description.get(), canvas);
Button startButton = new Button("Start");
startButton.setOnAction(event -> timeline.play());
startButton.setOnAction(event -> this.drawChaosGame());
Button stopButton = new Button("Stop");
stopButton.setOnAction(event -> timeline.stop());
......@@ -105,7 +108,7 @@ public class ChaosGameGUIView {
canvas.clearCanvas();
description.set(factory.getDescriptions().get(0)); // Assuming the Sierpinski description is at index 0
canvasRef.set(new ChaosCanvas(1000, 1000, description.get().getMinCoords(), description.get().getMaxCoords()));
canvasRef.set(new ChaosCanvas(10000, 10000, description.get().getMinCoords(), description.get().getMaxCoords()));
game = new ChaosGame(description.get(), canvasRef.get());
});
......@@ -117,7 +120,7 @@ public class ChaosGameGUIView {
setImageViewFromImage(newWritableImage);
canvas.clearCanvas();
description.set(factory.getDescriptions().get(1)); // Assuming the Sierpinski description is at index 0
canvasRef.set(new ChaosCanvas(1000, 1000, description.get().getMinCoords(), description.get().getMaxCoords()));
canvasRef.set(new ChaosCanvas(10000, 10000, description.get().getMinCoords(), description.get().getMaxCoords()));
game = new ChaosGame(description.get(), canvasRef.get());
});
......@@ -129,7 +132,7 @@ public class ChaosGameGUIView {
setImageViewFromImage(newWritableImage);
canvas.clearCanvas();
description.set(factory.getDescriptions().get(2)); // Assuming the Sierpinski description is at index 0
canvasRef.set(new ChaosCanvas(1000, 1000, description.get().getMinCoords(), description.get().getMaxCoords()));
canvasRef.set(new ChaosCanvas(10000, 10000, description.get().getMinCoords(), description.get().getMaxCoords()));
game = new ChaosGame(description.get(), canvasRef.get());
});
......@@ -206,7 +209,7 @@ public class ChaosGameGUIView {
ChaosCanvas canvas = game.getCanvas();
game.runSteps(100000);
game.runSteps(100000000);
// Test implementation for drawing fractals
int[][] betaArray = canvas.getCanvasArray();
......
Affine2D # Comment
0.0, 0.0 # Comment
1.0, 1.0 # Comment
0.5, 0.0, 0.0, 0.5, 0.0, 0.0 # Comment
0.5, 0.0, 0.0, 0.5, 0.25, 0.5 # Comment
0.5, 0.0, 0.0, 0.5, 0.5, 0.0 # Comment
Affine2D # Type of transform
0, 0 # Lower left
1, 1 # Upper right
.5, 0, 0, .5, 0, 0 # 1st transform (a00, a01, a10, a11, b0, b1)
.5, 0, 0, .5, .25, .5 # 2nd transform
.5, 0, 0, .5, .5, 0 # 3rd transform
Affine2D # Comment
-2.65, 0 # Comment
2.65, 10 # Comment
0, 0, 0, .16, 0, 0 # Comment
.85, .04, -.04, .85, 0, 1.6 # Comment
.2, -.26, .23, .22, 0, 1.6 # Comment
-.15, .28, .26, .24, 0, .44 # Comment
\ No newline at end of file
Affine2D # Type of transform
-2.65, 0 # lower left
2.65, 10 # upper right
0, 0, 0, .16, 0, 0 # transforms
.85, .04, -.04, .85, 0, 1.6
.2, -.26, .23, .22, 0, 1.6
-.15, .28, .26, .24, 0, .44
\ No newline at end of file
Julia # Comment
-1.6, -1 # Comment
1.6, 1 # Comment
-.74543, .11301 # Comment
\ No newline at end of file
Julia # Type of transform
-1.6, -1 # Lower left
1.6, 1 # Upper right
-.74543, .11301 # Real and imaginary parts of the constant c
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment