public Camera() { cameraToWorld = Matrix4d.Identity; WorldToCamera = Matrix4d.Identity; Sensor = new Sensor(); Lens = new ThinLens(); }
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); }
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); }
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); }
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); }
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; }