Beispiel #1
0
        public void TestTransferRayOutsideAperture()
        {
            // ray outside aperture but on the lens plane

            ThinLens thinLens = new ThinLens(5, 4);
            Vector3d lensPos = new Vector3d(20, 30, 0);
            Vector3d objectPos = new Vector3d(1, 2, 5);
            Ray expectedRay = new Ray(lensPos, new Vector3d(1, 2, 5));
            Ray outgoingRay = thinLens.Transfer(objectPos, lensPos);

            Assert.Null(outgoingRay);
        }
Beispiel #2
0
        public void TestTransferRayOutsideAperture()
        {
            // ray outside aperture but on the lens plane

            ThinLens thinLens    = new ThinLens(5, 4);
            Vector3d lensPos     = new Vector3d(20, 30, 0);
            Vector3d objectPos   = new Vector3d(1, 2, 5);
            Ray      expectedRay = new Ray(lensPos, new Vector3d(1, 2, 5));
            Ray      outgoingRay = thinLens.Transfer(objectPos, lensPos);

            Assert.Null(outgoingRay);
        }
Beispiel #3
0
        public void TestTransferRayInfiniteImage()
        {
            // |object.Z| = |f|, so that the image is at infinity in image space

            ThinLens thinLens = new ThinLens(5, 4);
            Vector3d lensPos = new Vector3d(2, 3, 0);
            Vector3d objectPos = new Vector3d(1, 2, 5);
            Ray expectedRay = new Ray(lensPos, new Vector3d(1, 2, 5));
            Ray outgoingRay = thinLens.Transfer(objectPos, lensPos);

            Assert.NotNull(outgoingRay);
            Assert.Equal(expectedRay, outgoingRay, rayComparer);
        }
Beispiel #4
0
        public void TestTransferRayInfiniteImage()
        {
            // |object.Z| = |f|, so that the image is at infinity in image space

            ThinLens thinLens    = new ThinLens(5, 4);
            Vector3d lensPos     = new Vector3d(2, 3, 0);
            Vector3d objectPos   = new Vector3d(1, 2, 5);
            Ray      expectedRay = new Ray(lensPos, new Vector3d(1, 2, 5));
            Ray      outgoingRay = thinLens.Transfer(objectPos, lensPos);

            Assert.NotNull(outgoingRay);
            Assert.Equal(expectedRay, outgoingRay, rayComparer);
        }
Beispiel #5
0
        public void TestTransferRayReverse()
        {
            // object from image space
            // |object.Z| > |f|
            // ray within aperture

            ThinLens thinLens = new ThinLens(5, 4);
            Vector3d lensPos = new Vector3d(2, 3, 0);
            Vector3d objectPos = new Vector3d(1, 2, -15);
            Ray expectedRay = new Ray(lensPos, new Vector3d(-2.5, -4.0, 7.5));
            Ray outgoingRay = thinLens.Transfer(objectPos, lensPos);

            Assert.NotNull(outgoingRay);
            Assert.Equal(expectedRay, outgoingRay, rayComparer);
        }
Beispiel #6
0
        public void TestTransferRayReverse()
        {
            // object from image space
            // |object.Z| > |f|
            // ray within aperture

            ThinLens thinLens    = new ThinLens(5, 4);
            Vector3d lensPos     = new Vector3d(2, 3, 0);
            Vector3d objectPos   = new Vector3d(1, 2, -15);
            Ray      expectedRay = new Ray(lensPos, new Vector3d(-2.5, -4.0, 7.5));
            Ray      outgoingRay = thinLens.Transfer(objectPos, lensPos);

            Assert.NotNull(outgoingRay);
            Assert.Equal(expectedRay, outgoingRay, rayComparer);
        }
Beispiel #7
0
        public void TestTransferRayStraightLensCenter()
        {
            // object from object space
            // |object.Z| > |f|
            // ray goes through the lens center

            ThinLens thinLens    = new ThinLens(5, 4);
            Vector3d lensPos     = new Vector3d(0, 0, 0);
            Vector3d objectPos   = new Vector3d(1, 2, 15);
            Ray      expectedRay = new Ray(lensPos, new Vector3d(-0.5, -1.0, -7.5));
            Ray      outgoingRay = thinLens.Transfer(objectPos, lensPos);

            Assert.NotNull(outgoingRay);
            Assert.Equal(expectedRay, outgoingRay, rayComparer);
        }
Beispiel #8
0
        public void TestTransferRayStraightLensCenter()
        {
            // object from object space
            // |object.Z| > |f|
            // ray goes through the lens center

            ThinLens thinLens = new ThinLens(5, 4);
            Vector3d lensPos = new Vector3d(0, 0, 0);
            Vector3d objectPos = new Vector3d(1, 2, 15);
            Ray expectedRay = new Ray(lensPos, new Vector3d(-0.5, -1.0, -7.5));
            Ray outgoingRay = thinLens.Transfer(objectPos, lensPos);

            Assert.NotNull(outgoingRay);
            Assert.Equal(expectedRay, outgoingRay, rayComparer);
        }