Exemplo n.º 1
0
        public Scientrace.SingleRaySource setSingleRayFromXData(XElement xlight, List <Scientrace.UniformTraceModifier> utms,
                                                                Scientrace.Object3dEnvironment env)
        {
            double distance     = this.X.getXDouble(xlight.Attribute("Distance"), 0);
            int    beamcount    = this.X.getXInt(xlight.Attribute("RayCount"), this.X.getXInt(xlight.Attribute("BeamCount"), 1));
            double minintensity = this.X.getXDouble(xlight, "MinIntensity", 0.01);             //default minimum intensity for tracing set to 1%

            Scientrace.NonzeroVector light_direction = this.X.getXNzVector(xlight.Element("Direction"));
            Scientrace.Location      centerloc       = this.X.getXVector(xlight.Element("Location")).toLocation();
            Scientrace.Location      locoffset       = (light_direction.toVector().negative() * distance).toLocation(); //distance cm above surface
            Scientrace.Location      loc             = locoffset + centerloc;
            XMLSpectrumParser        xsp             = new XMLSpectrumParser();

            Scientrace.LightSpectrum spectrum = xsp.parseLightSpectrum(xlight.Element("Spectrum"));
            if (spectrum == null)
            {
                throw new Exception("LightSpectrum " + xlight.Element("Spectrum").ToString() + " unknown");
            }

            Scientrace.SingleRaySource retlight = new Scientrace.SingleRaySource(new Scientrace.Line(loc, light_direction.toUnitVector()),
                                                                                 beamcount, spectrum, env);

            retlight.minimum_intensity_fraction = minintensity;
            retlight.lightsource_modifiers.AddRange(utms);
            retlight.init();
            return(retlight);
        }
Exemplo n.º 2
0
 public void TestIntersectionByVectorArray3()
 {
     Scientrace.Object3dEnvironment env = new Scientrace.Object3dEnvironment(Scientrace.AirProperties.Instance, 100);
     Scientrace.Line        beam        = new Scientrace.Line(10, 10, 10, -1, -1, 0);
     Scientrace.LightSource light       = new Scientrace.SingleRaySource(beam,
                                                                         10, new Scientrace.AM15Spectrum(1), env);
     Scientrace.Trace trace = new Scientrace.Trace(500.0E-9, light, beam, env, 1, 1);
     Console.WriteLine(trace.ToString());
     //Scientrace.Vector v = new Scientrace.Vector(10,10,10);
     Scientrace.IntersectionPoint[] ips = new Scientrace.IntersectionPoint[2];
     ips[0] = null;
     ips[1] = null;
     //Scientrace.Intersection intr = new Scientrace.Intersection(trace, ips);
     //Assert.IsFalse(intr.intersects);
 }
Exemplo n.º 3
0
 public void TestIntersectionByVectorArray3()
 {
     Scientrace.Object3dEnvironment env = new Scientrace.Object3dEnvironment(Scientrace.AirProperties.Instance, 100);
     Scientrace.Line beam = new Scientrace.Line(10, 10, 10, -1, -1, 0);
     Scientrace.LightSource light = new Scientrace.SingleRaySource(beam,
                                                                  10, new Scientrace.AM15Spectrum(1), env);
     Scientrace.Trace trace = new Scientrace.Trace(500.0E-9, light, beam, env,1,1);
     Console.WriteLine(trace.ToString());
     //Scientrace.Vector v = new Scientrace.Vector(10,10,10);
     Scientrace.IntersectionPoint[] ips = new Scientrace.IntersectionPoint[2];
     ips[0] = null;
     ips[1] = null;
     //Scientrace.Intersection intr = new Scientrace.Intersection(trace, ips);
     //Assert.IsFalse(intr.intersects);
 }
Exemplo n.º 4
0
        public Scientrace.SingleRaySource setSingleRayFromXData(XElement xlight, List<Scientrace.UniformTraceModifier> utms,
				Scientrace.Object3dEnvironment env)
        {
            double distance = this.X.getXDouble(xlight.Attribute("Distance"), 0);
            int beamcount = this.X.getXInt(xlight.Attribute("RayCount"), this.X.getXInt(xlight.Attribute("BeamCount"), 1));
            double minintensity = this.X.getXDouble(xlight, "MinIntensity", 0.01); //default minimum intensity for tracing set to 1%

            Scientrace.NonzeroVector light_direction = this.X.getXNzVector(xlight.Element("Direction"));
            Scientrace.Location centerloc = this.X.getXVector(xlight.Element("Location")).toLocation();
            Scientrace.Location locoffset = (light_direction.toVector().negative()*distance).toLocation(); //distance cm above surface
            Scientrace.Location loc = locoffset + centerloc;
                XMLSpectrumParser xsp = new XMLSpectrumParser();
            Scientrace.LightSpectrum spectrum = xsp.parseLightSpectrum(xlight.Element("Spectrum"));
            if (spectrum==null) { throw new Exception("LightSpectrum "+xlight.Element("Spectrum").ToString()+" unknown"); }

            Scientrace.SingleRaySource retlight = new Scientrace.SingleRaySource(new Scientrace.Line(loc, light_direction.toUnitVector()),
                beamcount, spectrum, env);

            retlight.minimum_intensity_fraction = minintensity;
            retlight.lightsource_modifiers.AddRange(utms);
            retlight.init();
            return retlight;
        }