Exemple #1
0
        public void TestRefractionAngleFromVectors()
        {
            Scientrace.UnitVector direction_incoming_trace = new Scientrace.UnitVector(1, 0, 1);
            Scientrace.Location   loc            = new Scientrace.Location(0, 0, 0);
            Scientrace.UnitVector surface_normal = new Scientrace.UnitVector(0, 0, 1);

            Scientrace.Trace aTrace = DummyObjects.DummyTrace(600E-9);
            aTrace.traceline.direction = direction_incoming_trace;

            double refindex_from = 1;
            double refindex_to   = 1.5;

            Scientrace.DielectricSurfaceInteraction fsi = new Scientrace.DielectricSurfaceInteraction(
                aTrace, loc,
                surface_normal, refindex_from, refindex_to, null);
            //Assert.AreEqual(fsi.dir_in.ToString(), fsi.surface_normal);
            Assert.AreEqual(fsi.dir_s.angleWith(fsi.dir_ip), Math.PI / 2);
            Assert.AreEqual(Math.Abs(fsi.amp_ip), Math.Abs(fsi.amp_is), 1E-10);
        }
 public static Scientrace.Trace DummyTrace(double wavelength)
 {
     return(new Scientrace.Trace(wavelength, DummyObjects.DummyLight(wavelength), DummyObjects.DummyLine(), null, 1, 1));
 }
 public static Scientrace.SingleRaySource DummyLight(double wavelength)
 {
     return(new Scientrace.SingleRaySource(DummyObjects.DummyLine(), 1,
                                           new Scientrace.SingleWavelengthSpectrum(1, wavelength), DummyObjects.DummyEnv()));
 }