コード例 #1
0
 public Camera()
 {
     cameraToWorld = Matrix4d.Identity;
     WorldToCamera = Matrix4d.Identity;
     Sensor        = new Sensor();
     Lens          = new ThinLens();
 }
コード例 #2
0
ファイル: ThinLensTest.cs プロジェクト: bzamecnik/bokehlab
        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);
        }
コード例 #3
0
ファイル: ThinLensTest.cs プロジェクト: VIPERWorld/bokehlab
        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);
        }
コード例 #4
0
ファイル: ThinLensTest.cs プロジェクト: bzamecnik/bokehlab
        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);
        }
コード例 #5
0
ファイル: ThinLensTest.cs プロジェクト: VIPERWorld/bokehlab
        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);
        }
コード例 #6
0
ファイル: ThinLensTest.cs プロジェクト: bzamecnik/bokehlab
        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);
        }
コード例 #7
0
ファイル: ThinLensTest.cs プロジェクト: VIPERWorld/bokehlab
        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);
        }
コード例 #8
0
ファイル: ThinLensTest.cs プロジェクト: VIPERWorld/bokehlab
        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);
        }
コード例 #9
0
        public LightTracer()
        {
            LightSourcePosition = new Vector3d(0, 0, -20);
            Sensor = new Sensor()
            {
                Shift = new Vector3d(0, 0, 10),
                Width = 4,
                Tilt  = new Vector3d(0, 0, 0)
            };
            SampleCount = 1000;
            ThinLens    = new ThinLens(10, 1);
            //Lens = ThinLens;
            LensWithTwoStops vignettingLens = new LensWithTwoStops()
            {
                Lens = ThinLens
            };

            vignettingLens.BackStop.Z  = -1;
            vignettingLens.FrontStop.Z = 1;
            Lens           = vignettingLens;
            LightIntensity = 0.5f;
        }
コード例 #10
0
ファイル: ThinLensTest.cs プロジェクト: bzamecnik/bokehlab
        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);
        }