Exemplo n.º 1
0
 /* ShadowClass constructor */
 public TriangularPrism(ShadowScientrace.ShadowObject3d shadowObject)
     : base(shadowObject)
 {
     switch (shadowObject.factory_id??"WidthHeightAndLength") { // ?? provides a "default method" when null
     case "WidthHeightAndLength":
         this.shadowFac_Width_Height_And_Length(shadowObject);
         break;
     default:
         throw new ArgumentOutOfRangeException("Factory id {"+shadowObject.factory_id+"} not found for "+shadowObject.typeString());
     }
 }
Exemplo n.º 2
0
        public DoubleConvexLens(ShadowScientrace.ShadowObject3d shadowObject)
            : base(shadowObject)
        {
            switch (shadowObject.factory_id) {
            case "TwoRadii_and_Diameter": this.shadowFac_TwoRadii_and_Diameter(shadowObject);
                break;
            case "TwoRadii_and_Locations": this.shadowFac_TwoRadii_and_Locations(shadowObject);
                break;
            case "FocalLength_and_Diameter": this.shadowFac_FocalLength_and_Diameter(shadowObject);
                break;
            default:
                throw new ArgumentOutOfRangeException("Factory method {"+shadowObject.factory_id+"} not found for "+shadowObject.typeString());

            }
        }
Exemplo n.º 3
0
        /*
        public FresnelLensRing(Object3dCollection parent, MaterialProperties mprops,
            Scientrace.Location lens_sphere_location, double lens_sphere_radius,
            double lens_sphere_radians_min, double lens_sphere_radians_max,
            Scientrace.UnitVector orientation_from_sphere_center) : base (parent, mprops) {
        this.paramInit(lens_sphere_location, lens_sphere_radius, lens_sphere_radians_min, lens_sphere_radians_max, orientation_from_sphere_center);
        }

        /// <summary>
        /// Factory method that creates a new FresnelLensRing based on the properties of another FresnelLensRing
        /// but mirrored about the flat plane (flatBottomBorder).
        /// </summary>
        /// <returns>
        /// The new FresnelLensRing
        /// </returns>
        /// <param name='aFresnelLensRing'>
        /// A FresnelLensRing to base the (copied) properties upon.
        /// </param>
        public static FresnelLensRing newOppositeDirectionRing(FresnelLensRing aFresnelLensRing) {
        Object3dCollection parent = aFresnelLensRing.parent;
        MaterialProperties mprops = aFresnelLensRing.materialproperties;
        Scientrace.Location lens_sphere_location = aFresnelLensRing.sphereLoc + (aFresnelLensRing.orientation*aFresnelLensRing.getDistanceToPlanoCenter()*2);
        double lens_sphere_radius = aFresnelLensRing.sphereRadius;
        double lens_sphere_radians_min = aFresnelLensRing.radiansMin;
        double lens_sphere_radians_max = aFresnelLensRing.radiansMax;
        Scientrace.UnitVector orientation_from_sphere_center = aFresnelLensRing.orientation.negative();
        return new FresnelLensRing(parent, mprops, lens_sphere_location, lens_sphere_radius, lens_sphere_radians_min, lens_sphere_radians_max, orientation_from_sphere_center);
        } */
        public FresnelLensRing(ShadowScientrace.ShadowObject3d shadowObject)
            : base(shadowObject)
        {
            switch (shadowObject.factory_id) {
            case "SphereCenterAndRadians": this.shadowFac_SphereCenter_And_Radians(shadowObject);
                break;
            case "PlanoCenterAndRadians": this.shadowFac_PlanoCenter_And_Radians(shadowObject);
                break;
            default:
                throw new ArgumentOutOfRangeException("Factory method {"+shadowObject.factory_id+"} not found for "+shadowObject.typeString());
            }

            //General stuff:
            this.x3dCurvedSegments = shadowObject.getInt("draw_3d_segment_linecount", this.x3dCurvedSegments);
        }