Пример #1
0
        public static double SolveX(Vector3d a1, Vector3d a2, Vector3d a3, Vector3d b)
        {
            double num  = Vector3d.Triple(a1, a2, a3);
            double num2 = Vector3d.Triple(b, a2, a3);

            if (Math.Abs(num) <= 4.94065645841247E-324)
            {
                throw new ArgumentException("Can not solve linear system: solver found zero determinant.");
            }
            return(num2 / num);
        }
Пример #2
0
 public CoordinateSystem(Point originPoint, Vector3d e1, Vector3d e2, Vector3d e3)
 {
     this.point_0 = originPoint;
     this.list_0  = new List <Vector3d>();
     this.list_0.Add(e1);
     this.list_0.Add(e2);
     this.list_0.Add(e3);
     if (Math.Abs(Vector3d.Triple(this.list_0[0].Normalize(), this.list_0[1].Normalize(), this.list_0[2].Normalize())) < ngeometry.VectorGeometry.Global.AbsoluteEpsilon)
     {
         throw new ArgumentException("Basis vectors are linearly dependent!");
     }
 }
Пример #3
0
        public double DistanceTo(Line line)
        {
            Vector3d vector3d  = this.DirectionVector.Normalize();
            Vector3d vector3d2 = line.DirectionVector.Normalize();
            Vector3d vector3d3 = Vector3d.Cross(vector3d, vector3d2);

            if (vector3d3.X * vector3d3.X + vector3d3.Y * vector3d3.Y + vector3d3.Z * vector3d3.Z < Global.AbsoluteEpsilon)
            {
                return(this.Point.DistanceTo(line));
            }
            double num = Vector3d.Triple(new Vector3d(line.Point - this.Point), vector3d, vector3d2);

            return(Math.Abs(num / vector3d3.Norm));
        }
Пример #4
0
        public static Vector3d SolveFull(Vector3d a1, Vector3d a2, Vector3d a3, Vector3d b)
        {
            double num = Vector3d.Triple(a1, a2, a3);

            if (Math.Abs(num) <= 4.94065645841247E-324)
            {
                throw new ArgumentException("Can not solve linear system: zero determinant.");
            }
            double num2 = Vector3d.Triple(b, a2, a3);
            double num3 = Vector3d.Triple(a1, b, a3);
            double num4 = Vector3d.Triple(a1, a2, b);
            double num5 = 1.0 / num;

            return(new Vector3d(num5 * num2, num5 * num3, num5 * num4));
        }
Пример #5
0
        public static double OrientedAngle(Vector3d a, Vector3d b, Vector3d n)
        {
            double num  = 6.2831853071795862;
            double num2 = Vector3d.Angle(a, b);

            if (Vector3d.Triple(n, a, b) < 0.0)
            {
                num2 = num - num2;
            }
            if (num2 > num)
            {
                num2 = 0.0;
            }
            return(num2);
        }
Пример #6
0
        private Point method_9(Line line_0)
        {
            if (this.IsParallelTo(line_0))
            {
                throw new ArgumentException("Can not compute base point of perpendicular: lines are parallel.");
            }
            Vector3d a        = this.vector3d_0.Normalize();
            Vector3d vector3d = -1.0 * line_0.vector3d_0.Normalize();
            Vector3d b        = new Vector3d(line_0.point_0 - this.point_0);
            Vector3d c        = Vector3d.Cross(a, vector3d).Normalize();
            double   num      = Vector3d.Triple(a, vector3d, c);
            double   num2     = Vector3d.Triple(a, b, c);

            if (Math.Abs(num) <= 4.94065645841247E-324)
            {
                return(this.method_3(line_0));
            }
            double scalar = num2 / num;

            return(line_0.point_0 - scalar * vector3d.ToPoint());
        }