Loading src/main/java/Shape/MovingObject.java 0 → 100644 +2 −0 Original line number Diff line number Diff line package Shape;public class MovingObject { } src/main/java/org/example/newmat/GraphicsAndWindowsTest.java +10 −19 Original line number Diff line number Diff line Loading @@ -17,7 +17,6 @@ import javafx.scene.transform.Translate; import javafx.stage.Stage; import java.io.IOException; import java.util.Arrays; /** Loading Loading @@ -53,24 +52,20 @@ public class GraphicsAndWindowsTest extends Application { cube.getTransforms().add(translate1); TriangleMesh mesh = new TriangleMesh(); /** /* * Texture coordinates used to add image to a mesh. * Initialized at 0, 0 since there is no need for an image. * */ float[] texCoords = { 0, 0 }; parameters = getParameters().getRaw().toArray(new String[getParameters().getRaw().size()]); //readFile.generateRandomVertices(1000); //readFile.randFileGenerator("testfile2.txt"); readFile processInput = new readFile(); processInput.parseCommand(parameters); processInput.makeVertexHash(processInput.path[0]); parameters = getParameters().getRaw().toArray(new String[0]); readFile processInput = new readFile(parameters); processInput.makeVertexHash(processInput.getPath()); //processInput.makeMatrix(); // System.out.print(processInput.adjMatrix.toString()); // System.out.print(Arrays.toString(processInput.getVertices())); // System.out.print(Arrays.toString(processInput.getFaces())); //Gives the vertices (points) to the mesh in the form of a float [] array mesh.getPoints().setAll(processInput.getVertices()); Loading Loading @@ -217,7 +212,7 @@ public class GraphicsAndWindowsTest extends Application { // find the vertices which come close to the bounding box threshold and squish them into the mesh for (int j = 0; j < points.length; j += 3) { if (Math.abs(points[j] + translate.getX() + directionX - minX) < 10 || Math.abs(points[j] + translate.getX() + directionX - maxX) < 10) { points[j] += -directionX*5; points[j] += (float) (-directionX*5); } } Loading @@ -233,7 +228,7 @@ public class GraphicsAndWindowsTest extends Application { // find the vertices which come close to the bounding box threshold and squish them into the mesh for (int j = 1; j < points.length; j += 3) { if (Math.abs(points[j] + translate.getY() + directionY - minY) < 10 || Math.abs(points[j] + translate.getY() + directionY - maxY) < 10) { points[j] += -directionY*5; points[j] += (float) (-directionY*5); } } Loading @@ -249,7 +244,7 @@ public class GraphicsAndWindowsTest extends Application { // find the vertices which come close to the bounding box threshold and squish them into the mesh for (int j = 2; j < points.length; j += 3) { if (Math.abs(points[j] + translate.getZ() + directionZ - minZ) < 10 || Math.abs(points[j] + translate.getZ() + directionZ - maxZ) < 10) { points[j] += -directionZ*5; points[j] += (float) (-directionZ*5); } } Loading @@ -259,10 +254,6 @@ public class GraphicsAndWindowsTest extends Application { } // if (newZ < 0 || newZ >300) { // directionZ = -directionZ; // } double newY = translate.getY() + directionY; translate.setY(newY); double newX = translate.getX() + directionX; Loading src/teapot.txt 0 → 100644 +0 −0 Empty file added. Loading
src/main/java/Shape/MovingObject.java 0 → 100644 +2 −0 Original line number Diff line number Diff line package Shape;public class MovingObject { }
src/main/java/org/example/newmat/GraphicsAndWindowsTest.java +10 −19 Original line number Diff line number Diff line Loading @@ -17,7 +17,6 @@ import javafx.scene.transform.Translate; import javafx.stage.Stage; import java.io.IOException; import java.util.Arrays; /** Loading Loading @@ -53,24 +52,20 @@ public class GraphicsAndWindowsTest extends Application { cube.getTransforms().add(translate1); TriangleMesh mesh = new TriangleMesh(); /** /* * Texture coordinates used to add image to a mesh. * Initialized at 0, 0 since there is no need for an image. * */ float[] texCoords = { 0, 0 }; parameters = getParameters().getRaw().toArray(new String[getParameters().getRaw().size()]); //readFile.generateRandomVertices(1000); //readFile.randFileGenerator("testfile2.txt"); readFile processInput = new readFile(); processInput.parseCommand(parameters); processInput.makeVertexHash(processInput.path[0]); parameters = getParameters().getRaw().toArray(new String[0]); readFile processInput = new readFile(parameters); processInput.makeVertexHash(processInput.getPath()); //processInput.makeMatrix(); // System.out.print(processInput.adjMatrix.toString()); // System.out.print(Arrays.toString(processInput.getVertices())); // System.out.print(Arrays.toString(processInput.getFaces())); //Gives the vertices (points) to the mesh in the form of a float [] array mesh.getPoints().setAll(processInput.getVertices()); Loading Loading @@ -217,7 +212,7 @@ public class GraphicsAndWindowsTest extends Application { // find the vertices which come close to the bounding box threshold and squish them into the mesh for (int j = 0; j < points.length; j += 3) { if (Math.abs(points[j] + translate.getX() + directionX - minX) < 10 || Math.abs(points[j] + translate.getX() + directionX - maxX) < 10) { points[j] += -directionX*5; points[j] += (float) (-directionX*5); } } Loading @@ -233,7 +228,7 @@ public class GraphicsAndWindowsTest extends Application { // find the vertices which come close to the bounding box threshold and squish them into the mesh for (int j = 1; j < points.length; j += 3) { if (Math.abs(points[j] + translate.getY() + directionY - minY) < 10 || Math.abs(points[j] + translate.getY() + directionY - maxY) < 10) { points[j] += -directionY*5; points[j] += (float) (-directionY*5); } } Loading @@ -249,7 +244,7 @@ public class GraphicsAndWindowsTest extends Application { // find the vertices which come close to the bounding box threshold and squish them into the mesh for (int j = 2; j < points.length; j += 3) { if (Math.abs(points[j] + translate.getZ() + directionZ - minZ) < 10 || Math.abs(points[j] + translate.getZ() + directionZ - maxZ) < 10) { points[j] += -directionZ*5; points[j] += (float) (-directionZ*5); } } Loading @@ -259,10 +254,6 @@ public class GraphicsAndWindowsTest extends Application { } // if (newZ < 0 || newZ >300) { // directionZ = -directionZ; // } double newY = translate.getY() + directionY; translate.setY(newY); double newX = translate.getX() + directionX; Loading