diff options
| author | alex <[email protected]> | 2026-11-06 08:18:11 +0100 |
|---|---|---|
| committer | alex <[email protected]> | 2026-11-06 08:18:11 +0100 |
| commit | 23915e415a814028f091fce1d205cccf4b3935d8 (patch) | |
| tree | 46b43c59e27ded5abe6092fcaff75de87d41dff7 /src/main/java/com/example/BoxRenderer.java | |
| parent | 7fc3f81546836be9d46c5d4616a5fea554a8b022 (diff) | |
| download | javafx-uloha-23915e415a814028f091fce1d205cccf4b3935d8.tar.xz javafx-uloha-23915e415a814028f091fce1d205cccf4b3935d8.zip | |
Diffstat (limited to 'src/main/java/com/example/BoxRenderer.java')
| -rw-r--r-- | src/main/java/com/example/BoxRenderer.java | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/main/java/com/example/BoxRenderer.java b/src/main/java/com/example/BoxRenderer.java index 9ec9c43..d0bee66 100644 --- a/src/main/java/com/example/BoxRenderer.java +++ b/src/main/java/com/example/BoxRenderer.java @@ -8,7 +8,7 @@ public class BoxRenderer { {0, 1}, {1, 2}, {2, 3}, {3, 0}, {4, 5}, {5, 6}, {6, 7}, {7, 4}, {0, 4}, {1, 5}, {2, 6}, {3, 7} - }; + }; // zoznam hran public void draw( GraphicsContext gc, @@ -25,8 +25,10 @@ public class BoxRenderer { double[][] vertices = { {-hw, -hh, -hd}, {hw, -hh, -hd}, {hw, hh, -hd}, {-hw, hh, -hd}, {-hw, -hh, hd}, {hw, -hh, hd}, {hw, hh, hd}, {-hw, hh, hd} - }; + }; //zoznam pozicii rohov + + //matematika double[][] projected = new double[8][2]; double cx = canvasWidth / 2.0; double cy = canvasHeight / 2.0; @@ -40,7 +42,7 @@ public class BoxRenderer { double x = vertices[i][0]; double y = vertices[i][1]; double z = vertices[i][2]; - + //vzorec na vypocitanie konverzie 3D na 2D double x1 = x * cosY + z * sinY; double z1 = -x * sinY + z * cosY; double y2 = y * cosX - z1 * sinX; @@ -58,7 +60,7 @@ public class BoxRenderer { for (int[] edge : EDGES) { int a = edge[0]; int b = edge[1]; - gc.strokeLine(projected[a][0], projected[a][1], projected[b][0], projected[b][1]); + gc.strokeLine(projected[a][0], projected[a][1], projected[b][0], projected[b][1]);//kreslenie hran } } } |
