Пример #1
0
        private double SolidAngle()
        {
            Func <Vector_3d, Vector_3d, Vector_3d, double> solid_angle_estimator = (Vector_3d r1, Vector_3d r2, Vector_3d r3) =>
            {
                double numerator   = Math.Abs(Vector_3d.Scalar(r1, Vector_3d.Vector(r2, r3)));
                double denumerator = r1.Lenght * r2.Lenght * r3.Lenght +
                                     Vector_3d.Scalar(r1, r2) * r3.Lenght +
                                     Vector_3d.Scalar(r2, r3) * r1.Lenght +
                                     Vector_3d.Scalar(r3, r1) * r2.Lenght;
                return(2.0 * Math.Atan2(numerator, denumerator));
            };

            Vector_3d mirror_center = new Vector_3d(this.SrcDist * Math.Cos(Rad(this.ScatterAngle)), this.SrcDist * Math.Sin(Rad(this.ScatterAngle)), 0.0);
            Vector_3d upper_left    = new Vector_3d(mirror_center.x - this.crystalW / 2, mirror_center.y, this.crystalH / 2.0),
                      down_left     = new Vector_3d(mirror_center.x - this.crystalW / 2, mirror_center.y, -this.crystalH / 2.0),
                      upper_right   = new Vector_3d(mirror_center.x + this.crystalW / 2, mirror_center.y, this.crystalH / 2.0),
                      down_right    = new Vector_3d(mirror_center.x + this.crystalW / 2, mirror_center.y, -this.crystalH / 2.0);


            double left_triangle  = solid_angle_estimator(down_left, upper_left, upper_right);
            double right_triangle = solid_angle_estimator(upper_right, down_right, down_left);

            return(left_triangle + right_triangle);
        }
Пример #2
0
 static public Vector_3d Vector(Vector_3d a, Vector_3d b)
 {
     return(new Vector_3d(a.y * b.z - a.z * b.y,
                          a.z * b.x - a.x * b.z,
                          a.x * b.y - a.y * b.x));
 }
Пример #3
0
 static public double Scalar(Vector_3d v1, Vector_3d v2)
 {
     return(v1.x * v2.x + v1.y * v2.y + v1.z * v2.z);
 }