public ParallelRandomSquareLightSource(ShadowScientrace.ShadowLightSource shadowObject) : base(shadowObject) { int? random_seed = shadowObject.getNInt("random_seed"); Scientrace.Location location = shadowObject.getLocation("location"); //corner Scientrace.UnitVector direction = shadowObject.getUnitVector("direction"); int ray_count = shadowObject.getInt("ray_count"); //linecount, this.distance = shadowObject.getDouble("distance", 0);//distance, //This line has been moved to the LightSource parent shadowconstructor //Scientrace.LightSpectrum spectrum = (Scientrace.LightSpectrum)shadowObject.getObject("spectrum"); //spectrum Scientrace.Vector width = shadowObject.getVector("width");//urange, Scientrace.Vector height = shadowObject.getVector("height");//vrange, Random randNum; if (random_seed == null || random_seed== -1) randNum = new Random(); else randNum = new Random((int)random_seed); for (int iline = 0; iline < ray_count; iline++) { Scientrace.Line line = new Scientrace.Line(location+(width*randNum.NextDouble()+(height*randNum.NextDouble())).toLocation(), direction); // THIS IS BEING DONE BY THE PARENT LIGHTSOURCE CLASS ALREADY: line.startingpoint = line.startingpoint - (direction.toLocation()*distance); Scientrace.Trace newtrace = new Scientrace.Trace(spectrum.wl(iline), this, line, env, spectrum.it(iline), spectrum.it(iline)); newtrace.traceid = "RS"+(random_seed==null?"r":random_seed.ToString())+"-"+iline; this.addTrace(newtrace); } //end for }
/* CONSTRUCTORS */ public FlatSurfaceObject3d(ShadowScientrace.ShadowObject3d aShadowObject) : base(aShadowObject) { //only front surface by default: //this.x3d_fill = aShadowObject.getBool("x3d_fill", this.x3d_fill); this.x3d_fill_emissive_color = aShadowObject.getColorFromHTML("x3d_fill_emissive_color_html", this.x3d_fill_emissive_color); this.x3d_fill_diffuse_color = aShadowObject.getColorFromHTML("x3d_fill_diffuse_color_html", this.x3d_fill_diffuse_color); this.x3d_fill_bitmap = aShadowObject.getString("x3d_fill_bitmap"); this.x3d_fill_both_sides = aShadowObject.getBool("x3d_fill_both_sides", this.x3d_fill_both_sides); //this.x3d_fill_diffuse = aShadowObject.getBool("x3d_fill_diffuse", this.x3d_fill_diffuse); this.x3d_fill_normal = aShadowObject.getVector("x3d_fill_normal", this.x3d_fill_normal); }