/// <summary> /// Required parameters: /// (Location)center_location /// (Location)pointing_towards /// (UnitVector)orthogonal_direction /// (double)side_length /// </summary> /// <param name='shadowObject'> /// Shadow object containing parameters from summary. /// </param> protected void shadowFac_Center_and_Sidelength(ShadowScientrace.ShadowObject3d shadowObject) { //User values(s) Scientrace.Location center_location = shadowObject.getLocation("center_location"); Scientrace.Location pointing_towards = shadowObject.getLocation("pointing_towards"); Scientrace.UnitVector orthogonal_direction = shadowObject.getUnitVector("orthogonal_direction"); double side_length = shadowObject.getDouble("side_length"); //construct! this.init_Center_and_Sidelength(center_location, pointing_towards, orthogonal_direction, side_length); }
/// <summary> /// Required parameters: /// (Location) lens_plano_center, /// (double) lens_radius /// (double) var_rings_count double value instead of int, so the ring may end in a ring-fraction /// (NonzeroVector) focal_vector /// (double) refractive_index derived from SO3D at a given wavelength (600E-9 by default) /// </summary> /// <param name='shadowObject'> /// Shadow object containing parameters from summary. /// </param> protected void shadowFac_VariusRadii_and_EqualWidthRings(ShadowScientrace.ShadowObject3d ringTemplateSO3D) { //Console.WriteLine("CREATING EQUAL WIDTH RINGS"); //User values(s) //NOT USED: Scientrace.Location lens_plano_center = (Scientrace.Location)shadowObject.getObject("lens_plano_center"); //NOT USED: double lens_sphere_radius = (double)shadowObject.getObject("lens_sphere_radius"); //NOT USED: Scientrace.UnitVector orientation_from_sphere_center = (Scientrace.UnitVector)shadowObject.getObject("orientation_from_sphere_center"); double radius = ringTemplateSO3D.getDouble("lens_radius"); double ring_count = ringTemplateSO3D.getDouble("var_rings_count"); //construct by creating FresnelLensRing Object3D instances and adding them to collection double ring_width = radius / ring_count; double focal_length = ringTemplateSO3D.getDouble("focal_length"); double focus_wavelength = ringTemplateSO3D.getDouble("focus_wavelength", 600E-9); double refindex = ringTemplateSO3D.materialprops.refractiveindex(focus_wavelength); for (double iring = 0; iring <= ring_count - 1; iring += 1) { double rmin = iring * ring_width; double rmax = Math.Min(iring + 1, ring_count) * ring_width; double ravg = (rmin + rmax) / 2; double ring_sphere_radius = FresnelLens.GetOptimalRingSphereRadius(focal_length, ravg, refindex, rmax); //Console.WriteLine("Radius "+iring+ ": {"+ring_sphere_radius+"}, rmin: {"+rmin+"}, rmax: {"+rmax+"}, xy_ratio: {"+xy_ratio+"}"); ShadowScientrace.ShadowObject3d so3d = new ShadowScientrace.ShadowObject3d(ringTemplateSO3D); so3d.factory_id = "PlanoCenterAndRadians"; so3d.arguments["lens_sphere_radians_min"] = FresnelLensRing.RadiansForRadii(ring_sphere_radius, rmin); so3d.arguments["lens_sphere_radians_max"] = FresnelLensRing.RadiansForRadii(ring_sphere_radius, rmax); so3d.arguments["lens_sphere_radius"] = ring_sphere_radius; so3d.parent = this; new FresnelLensRing(so3d); } }
/// <summary> /// Required parameters: /// (double)focal_length /// (Location)lens_center /// (NonzeroVector)optical_axis /// (double)lens_diameter /// </summary> /// <param name='shadowObject'> /// Shadow object containing parameters from summary. /// </param> protected void shadowFac_FocalLength_and_Diameter(ShadowScientrace.ShadowObject3d shadowObject) { //User values(s) double focalLength = (double)shadowObject.getObject("focal_length"); Scientrace.Location lensCenter = (Scientrace.Location)shadowObject.getObject("lens_center"); Scientrace.NonzeroVector lensPlaneNormal = (Scientrace.NonzeroVector)shadowObject.getObject("optical_axis"); double lensDiameter = (double)shadowObject.getObject("lens_diameter"); //Derived value from 1/f = (n-1)(1/r1+1/r2) double focus_wavelength = shadowObject.getDouble("focus_wavelength", 600E-9); double sphereRadii = 2 * focalLength * (shadowObject.materialprops.refractiveindex(focus_wavelength) - 1); //construct! this.initWithLensDiameter(lensCenter, lensPlaneNormal, lensDiameter, sphereRadii, sphereRadii); }