예제 #1
0
        //constructor
        public AngleDerivation(double par_mirr_angle_with_z_degrees, double fresnel_normal_with_z_degrees, double refractive_index)
        {
            //debug storage:
            this.debug_mirr_angle_deg = par_mirr_angle_with_z_degrees; this.debug_fresnel_angle_deg = fresnel_normal_with_z_degrees;

            //storing relevant variables
            this.refractive_index = refractive_index;
            this.fresnel_norm_z   = Math.Cos(AngleDerivation.getRadians(fresnel_normal_with_z_degrees));
            this.par_mirr_z       = Math.Cos(AngleDerivation.getRadians(par_mirr_angle_with_z_degrees));
        }
예제 #2
0
        public void setIncomingLightAngle(double angle_with_z_axis, double angle_with_x_axis)
        {
            double opx, opy, opz, xangle, zangle;

            Scientrace.Vector op;
            zangle = AngleDerivation.getRadians(angle_with_z_axis);
            xangle = AngleDerivation.getRadians(angle_with_x_axis);
            opx    = Math.Sin(zangle) * Math.Cos(xangle);
            opy    = Math.Sin(zangle) * Math.Sin(xangle);
            opz    = Math.Sqrt(1 - (opy * opy) - (opx * opx));
            op     = new Scientrace.Vector(opx, opy, opz);
            this.setIncomingLightVector(op);
        }
예제 #3
0
        public void setOutputAngles(double nxo, double nyo, double uxo, double uyo)
        {
            double nx, ny, ux, uy;
            double rn = Math.Sqrt((nxo * nxo) + (nyo * nyo));
            double ru = Math.Sqrt((uxo * uxo) + (uyo * uyo));

            nx        = nxo / rn;
            ny        = nyo / rn;
            ux        = uxo / ru;
            uy        = uyo / ru;
            this.nrad = AngleDerivation.getRadians(nx, ny);
            this.urad = AngleDerivation.getRadians(ux, uy);
            this.removeNans();
            //Console.WriteLine(this.nrad+"AFTER");
        }
예제 #4
0
        public void getnyuy(ref double ny, ref double uy, double ra, double rb, double A, double B, double py, double c)
        {
            double s = this.refractive_index;
            double nyp, nym;
            double uyp, uym;

            nyp = Math.Sqrt((ra * ra) - (A * A));
            //positive squareroot
            nym = -Math.Sqrt((ra * ra) - (A * A));
            //negative "
            uyp = Math.Sqrt((rb * rb) - (B * B));
            uym = -Math.Sqrt((rb * rb) - (B * B));
            if (AngleDerivation.closeEnough((uyp - (s * py)) / (nyp), c))
            {
                ny = nyp;
                uy = uyp;
                return;
            }
            if (AngleDerivation.closeEnough((uyp - (s * py)) / (nym), c))
            {
                ny = nym;
                uy = uyp;
                return;
            }
            if (AngleDerivation.closeEnough((uym - (s * py)) / (nyp), c))
            {
                ny = nyp;
                uy = uym;
                return;
            }
            if (AngleDerivation.closeEnough((uym - (s * py)) / (nym), c))
            {
                ny = nym;
                uy = uym;
                return;
            }
        }
예제 #5
0
        public void printAngles(double nxo, double nyo, double uxo, double uyo)
        {
            double nx, ny, ux, uy;
            double rn = Math.Sqrt((nxo * nxo) + (nyo * nyo));
            double ru = Math.Sqrt((uxo * uxo) + (uyo * uyo));

            nx = nxo / rn;
            ny = nyo / rn;
            ux = uxo / ru;
            uy = uyo / ru;
            //Console.WriteLine ("\n\n nrad = " + this.getRadians (nx, ny) + "rad, n = {" + nxo + ";" + nyo + "; " + Math.Sqrt (1.0 - rn * rn) + "}" + "\n urad = " + this.getRadians (ux, uy) + "rad, u = {" + uxo + ";" + uyo + "; " + Math.Sqrt (1.0 - ru * ru) + "}" + "\n diff (deg): " + ((this.getDAngle (nx, ny) - this.getDAngle (ux, uy))));
            Console.WriteLine("\n\n nrad = " + this.nrad + "rad, n = {" + nxo + ";" + nyo + "; " + Math.Sqrt(1.0 - rn * rn) + "}" + "\n urad = " + this.urad + "rad, u = {" + uxo + ";" + uyo + "; " + Math.Sqrt(1.0 - ru * ru) + "}" + "\n diff (deg): " + ((AngleDerivation.getDAngle(nx, ny) - AngleDerivation.getDAngle(ux, uy))));
        }