diff --git a/cameraproject/src/elements/Camera.java b/cameraproject/src/elements/Camera.java index b17f881..7d74309 100644 --- a/cameraproject/src/elements/Camera.java +++ b/cameraproject/src/elements/Camera.java @@ -96,9 +96,9 @@ public Vector getvRight() { /** * Defining the length and width of the view plane (builder design template) * - * @param width of the view plane (Greater than zero) + * @param width of the view plane (Greater than zero) * @param height of the view plane (Greater than zero) - * @return the camera itself + * @return the camera itself */ public Camera setViewPlaneSize(double width, double height) { if (width < 0 || isZero(width) || height < 0 && isZero(height)) @@ -112,7 +112,7 @@ public Camera setViewPlaneSize(double width, double height) { * Defines the distance of the view plane from the camera * * @param distance of the view plane from the camera (Greater than zero) - * @return the camera itself + * @return the camera itself */ public Camera setViewPlaneDistance(double distance) { if (distance < 0 || isZero(distance)) @@ -126,8 +126,8 @@ public Camera setViewPlaneDistance(double distance) { * * @param nX - Number of columns in the view plane * @param nY - Number of rows in the view plane - * @param j - The column number of the pixel - * @param i - The row number of the pixel + * @param j - The column number of the pixel + * @param i - The row number of the pixel * @return Ray from the camera through the desired pixel */ public Ray constructRayThroughPixel(int nX, int nY, int j, int i) { diff --git a/cameraproject/src/unittests/elements/IntegrationTest.java b/cameraproject/src/unittests/elements/IntegrationTest.java index 068e5cc..423c453 100644 --- a/cameraproject/src/unittests/elements/IntegrationTest.java +++ b/cameraproject/src/unittests/elements/IntegrationTest.java @@ -76,17 +76,18 @@ public void testPlane() { Camera camera = new Camera(new Point3D(0, 0, 0), new Vector(0, 0, -1), new Vector(0, 1, 0)); camera.setViewPlaneSize(3, 3); camera.setViewPlaneDistance(1); - + // TC01: Plane is parallel to the view plane - Plane plane = new Plane(new Point3D(2, 0, -1), new Vector(0,0,-1)); - assertEquals("plane, paralell to the view plane, wrong number of intersection points", 9, getSumIntersections(camera, plane)); - - // TC02: Plane has angles that allow for 9 points + Plane plane = new Plane(new Point3D(2, 0, -1), new Vector(0, 0, -1)); + assertEquals("plane, paralell to the view plane, wrong number of intersection points", 9, + getSumIntersections(camera, plane)); + + // TC02: Plane has angles that allow for 9 points plane = new Plane(new Point3D(0, 0, -3), new Vector(0, 0.5, -1)); assertEquals("plane, paralell to the view plane, wrong number of intersection points", 9, - getSumIntersections(camera, plane)); - - // TC03: Plane has a 90 degree angle with ray + getSumIntersections(camera, plane)); + + // TC03: Plane has a 90 degree angle with ray plane = new Plane(new Point3D(0, 0, -3), new Vector(0, 1, -1)); assertEquals("plane, paralell to the view plane, wrong number of intersection points", 6, getSumIntersections(camera, plane)); @@ -103,7 +104,7 @@ public void testTriangle() { Camera camera = new Camera(new Point3D(0, 0, 0), new Vector(0, 0, -1), new Vector(0, 1, 0)); camera.setViewPlaneSize(3, 3); camera.setViewPlaneDistance(1); - + // TC01: small triangle is in range of 1 vector Triangle triangle = new Triangle(new Point3D(0, 1, -2), new Point3D(1, -1, -2), new Point3D(-1, -1, -2)); assertEquals("triangle, is small, creating one point, wrong number of intersection points", 1,