public RandomCircleLightSource(Scientrace.Object3dEnvironment env, Scientrace.Location center, Scientrace.UnitVector direction, Scientrace.Plane plane, double radius, int linecount, LightSpectrum spectrum) : base(env) { //this.direction = direction; Random randNum = new Random(); Scientrace.UnitVector urange, vrange; double r1, r2; urange = plane.u.toUnitVector(); vrange = plane.v.toUnitVector(); Scientrace.Line line; for (int iline = 0; iline < linecount; iline++) { //Scientrace.Line line = new Scientrace.Line(loc+(urange*randNum.NextDouble()+(vrange*randNum.NextDouble())).toLocation(), direction); r1 = 1-randNum.NextDouble()*2; r2 = 1-randNum.NextDouble()*2; if (Math.Pow(r1,2)+Math.Pow(r2,2)<1) { line = new Scientrace.Line(center+((urange*r1*radius)+(vrange*r2*radius)).toLocation(),direction); } else { iline--; continue; } //this.traces.Add(new Scientrace.Trace(wavelength*0.6, this, line, env)); //this.traces.Add(new Scientrace.Trace(wavelength*0.8, this, line, env)); //double wavelength = wlmin+(randNum.NextDouble()*(wlmax-wlmin)); double wavelength = spectrum.wl(iline); double intensity = spectrum.it(iline); Console.WriteLine("Warning: ParallelRandomCylindricalLightSource does not use modulo yet"); this.addTrace(new Scientrace.Trace(wavelength, this, line, env, intensity, intensity)); //this.traces.Add(new Scientrace.Trace(wavelength*1.2, this, line, env)); //this.traces.Add(new Scientrace.Trace(wavelength*1.4, this, line, env)); } }
public SingleRaySource(Scientrace.Line rayline, int raycount, LightSpectrum spectrum, Scientrace.Object3dEnvironment env) : base(env) { this.weighted_intensity = spectrum.total_intensity; this.spectrum = spectrum; this.linecount = raycount; this.ray = rayline; }
public SpiralLightSource(Scientrace.Object3dEnvironment env, Scientrace.Location center, Scientrace.UnitVector direction, Scientrace.Plane plane, int linecount, double radius, double loops, double distance, LightSpectrum spectrum) : base(env) { /*Scientrace.UniformTraceModifier utm = * //new UniformTraceModifier(DistributionPattern.PeriodicSingleCircle, SpatialDistribution.UniformAngles); * new UniformTraceModifier(DistributionPattern.SquareGrid, SpatialDistribution.UniformProjections); * utm.add_self = false; * utm.setMaxAngleDeg(0.5); * utm.modify_traces_count = 16; * utm.randomSeed = 1; * this.modifiers.Add(utm); */ //this.init_findmultip(env, center, direction, plane, linecount, radius, loops, spectrum); this.paramInit(center, direction, plane, linecount, radius, loops, distance); }
public LightSource(ShadowScientrace.ShadowLightSource aShadowLightSource) { this.setObjectEnvironment(aShadowLightSource.env); this.minimum_intensity_fraction = aShadowLightSource.getDouble("minimum_intensity_fraction", this.minimum_intensity_fraction); this.addTraceModifiers((IEnumerable<Scientrace.UniformTraceModifier>)aShadowLightSource.getObject("trace_modifiers", true)); //AND it was put back like a normal ShadowClass object... //this.spectrum = aShadowLightSource.spectrum; this.spectrum = (Scientrace.LightSpectrum)aShadowLightSource.getObject("spectrum", !this.mandatory_spectrum); if (spectrum == null) Console.WriteLine("WARNING: No spectrum given."); this.efficiency_characteristics = (Scientrace.OpticalEfficiencyCharacteristics)aShadowLightSource.getObject("efficiency_characteristics"); this.weighted_intensity = (double)(aShadowLightSource.getNDouble("weighted_intensity") ?? this.spectrum.total_intensity); }
public SpiralLightSource(Scientrace.Object3dEnvironment env, Scientrace.Location center, Scientrace.UnitVector direction, Scientrace.Plane plane, int linecount, double radius, double loops, double distance, LightSpectrum spectrum) : base(env) { /*Scientrace.UniformTraceModifier utm = //new UniformTraceModifier(DistributionPattern.PeriodicSingleCircle, SpatialDistribution.UniformAngles); new UniformTraceModifier(DistributionPattern.SquareGrid, SpatialDistribution.UniformProjections); utm.add_self = false; utm.setMaxAngleDeg(0.5); utm.modify_traces_count = 16; utm.randomSeed = 1; this.modifiers.Add(utm); */ //this.init_findmultip(env, center, direction, plane, linecount, radius, loops, spectrum); this.paramInit(center,direction,plane,linecount,radius,loops, distance); }
public LightSource(ShadowScientrace.ShadowLightSource aShadowLightSource) { this.setObjectEnvironment(aShadowLightSource.env); this.minimum_intensity_fraction = aShadowLightSource.getDouble("minimum_intensity_fraction", this.minimum_intensity_fraction); this.addTraceModifiers((IEnumerable <Scientrace.UniformTraceModifier>)aShadowLightSource.getObject("trace_modifiers", true)); //AND it was put back like a normal ShadowClass object... //this.spectrum = aShadowLightSource.spectrum; this.spectrum = (Scientrace.LightSpectrum)aShadowLightSource.getObject("spectrum", !this.mandatory_spectrum); if (spectrum == null) { Console.WriteLine("WARNING: No spectrum given."); } this.efficiency_characteristics = (Scientrace.OpticalEfficiencyCharacteristics)aShadowLightSource.getObject("efficiency_characteristics"); this.weighted_intensity = (double)(aShadowLightSource.getNDouble("weighted_intensity") ?? this.spectrum.total_intensity); }
public RandomCircleLightSource(Scientrace.Object3dEnvironment env, Scientrace.Location center, Scientrace.UnitVector direction, Scientrace.Plane plane, double radius, int linecount, LightSpectrum spectrum) : base(env) { //this.direction = direction; Random randNum = new Random(); Scientrace.UnitVector urange, vrange; double r1, r2; urange = plane.u.toUnitVector(); vrange = plane.v.toUnitVector(); Scientrace.Line line; for (int iline = 0; iline < linecount; iline++) { //Scientrace.Line line = new Scientrace.Line(loc+(urange*randNum.NextDouble()+(vrange*randNum.NextDouble())).toLocation(), direction); r1 = 1 - randNum.NextDouble() * 2; r2 = 1 - randNum.NextDouble() * 2; if (Math.Pow(r1, 2) + Math.Pow(r2, 2) < 1) { line = new Scientrace.Line(center + ((urange * r1 * radius) + (vrange * r2 * radius)).toLocation(), direction); } else { iline--; continue; } //this.traces.Add(new Scientrace.Trace(wavelength*0.6, this, line, env)); //this.traces.Add(new Scientrace.Trace(wavelength*0.8, this, line, env)); //double wavelength = wlmin+(randNum.NextDouble()*(wlmax-wlmin)); double wavelength = spectrum.wl(iline); double intensity = spectrum.it(iline); Console.WriteLine("Warning: ParallelRandomCylindricalLightSource does not use modulo yet"); this.addTrace(new Scientrace.Trace(wavelength, this, line, env, intensity, intensity)); //this.traces.Add(new Scientrace.Trace(wavelength*1.2, this, line, env)); //this.traces.Add(new Scientrace.Trace(wavelength*1.4, this, line, env)); } }