Exemplo n.º 1
0
 private IList <ComplexLens> CreateLenses()
 {
     return(new List <ComplexLens>(
                new[] {
         ComplexLens.CreateDoubleGaussLens(Materials.Fixed.AIR, 4.0),
         ComplexLens.CreatePetzvalLens(Materials.Fixed.AIR, 4.0),
         ComplexLens.CreateBiconvexLens(150, 100, 0)
     }
                ));
 }
Exemplo n.º 2
0
        public void TraceRays()
        {
            ComplexLens lens = ComplexLens.CreateBiconvexLens(4, 2, 0);

            Sampler  sampler         = new Sampler();
            int      sampleCount     = 64;
            int      sqrtSampleCount = (int)Math.Sqrt(sampleCount);
            Vector3d objectPos       = new Vector3d(10, 0, 100);

            foreach (Vector2d sample in sampler.GenerateJitteredSamples(sqrtSampleCount))
            {
                Vector3d lensPos = lens.GetBackSurfaceSample(sample);
                Ray      result  = lens.Transfer(objectPos, lensPos);
            }
        }
Exemplo n.º 3
0
        public void TraceSingleRay()
        {
            ComplexLens lens = ComplexLens.CreateBiconvexLens(4, 2, 0);

            Sampler      sampler         = new Sampler();
            int          sampleCount     = 64;
            int          sqrtSampleCount = (int)Math.Sqrt(sampleCount);
            Vector3d     objectPos       = new Vector3d(10, 0, 100);
            Vector3d     direction       = new Vector3d(0, 0, 0);
            Ray          ray             = new Ray(objectPos, direction);
            Intersection isec            = lens.Intersect(ray);

            if (isec == null)
            {
                return;
            }
            Ray result = lens.Transfer(objectPos, isec.Position);
        }
Exemplo n.º 4
0
        public BiconvexLensForm()
        {
            InitializeComponent();
            biconvexLens = new BiconvexLens()
            {
                CurvatureRadius = 150,
                ApertureRadius  = 100,
                RefractiveIndex = Materials.Fixed.GLASS_CROWN_BK7
            };
            complexLens = ComplexLens.CreateBiconvexLens(150, 100, 0);
            double directionPhi = Math.PI;

            incomingRay = new Ray(new Vector3d(70, 0, 150), new Vector3d(Math.Sin(directionPhi), 0, Math.Cos(directionPhi)));

            rayDirectionPhiNumeric.Value = (decimal)directionPhi;
            curvatureRadiusNumeric.Value = (decimal)biconvexLens.CurvatureRadius;
            apertureRadiusNumeric.Value  = (decimal)biconvexLens.ApertureRadius;
            FillVectorToControls(incomingRay.Origin, rayOriginXNumeric, rayOriginYNumeric, rayOriginZNumeric);
            initialized = true;
            Recompute();
        }