public CoordinateTransformator2(CoordinateSystem actualCS, CoordinateSystem newCS)
        {
            //System.ComponentModel.LicenseManager.Validate(typeof(CoordinateTransformator2));
            //base..ctor();
            if (actualCS == newCS)
            {
                this.bool_0 = true;
            }
            this.coordinateSystem_0 = actualCS;
            this.coordinateSystem_1 = newCS;
            ngeometry.VectorGeometry.Matrix3d basisVectorMatrix = actualCS.BasisVectorMatrix;
            ngeometry.VectorGeometry.Matrix3d matrix3d          = newCS.BasisVectorMatrix.Invert();
            ngeometry.VectorGeometry.Matrix3d matrix3d2         = matrix3d * basisVectorMatrix;
            double num  = actualCS.Origin.X - newCS.Origin.X;
            double num2 = actualCS.Origin.Y - newCS.Origin.Y;
            double num3 = actualCS.Origin.Z - newCS.Origin.Z;

            this.double_0  = matrix3d2.a00;
            this.double_1  = matrix3d2.a01;
            this.double_2  = matrix3d2.a02;
            this.double_3  = matrix3d2.a10;
            this.double_4  = matrix3d2.a11;
            this.double_5  = matrix3d2.a12;
            this.double_6  = matrix3d2.a20;
            this.double_7  = matrix3d2.a21;
            this.double_8  = matrix3d2.a22;
            this.double_9  = matrix3d.a00 * num + matrix3d.a01 * num2 + matrix3d.a02 * num3;
            this.double_10 = matrix3d.a10 * num + matrix3d.a11 * num2 + matrix3d.a12 * num3;
            this.double_11 = matrix3d.a20 * num + matrix3d.a21 * num2 + matrix3d.a22 * num3;
        }
Exemple #2
0
        private PointSet method_3(Autodesk.AutoCAD.DatabaseServices.Circle circle_0, double double_1)
        {
            PointSet result;

            try
            {
                PointSet pointSet = new PointSet();
                ngeometry.VectorGeometry.Circle circle = Conversions.ToCeometricCircle(circle_0);
                if (double_1 > 0.0 && double_1 < circle.Circumference)
                {
                    int    num   = Math.Max((int)Math.Ceiling(circle.Circumference / double_1), 4);
                    double num2  = 6.2831853071795862 / (double)num;
                    Point  point = Conversions.ToCeometricPoint(circle_0.StartPoint);
                    for (int i = 0; i < num; i++)
                    {
                        ngeometry.VectorGeometry.Matrix3d rotationMatrix = ngeometry.VectorGeometry.Matrix3d.RotationArbitraryAxis(circle.NormalVector, (double)i * num2);
                        pointSet.Add(point.Rotate(circle.Center, rotationMatrix));
                    }
                }
                else
                {
                    pointSet.Add(circle.Center);
                }
                result = pointSet;
            }
            catch (System.Exception ex)
            {
                Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor.WriteMessage("Can not subdivide circle (handle: " + circle_0.Handle.ToString() + ")\n");
                result = null;
            }
            return(result);
        }
Exemple #3
0
        public CoordinateTransformator(CoordinateSystem actualCS, CoordinateSystem newCS)
        {
            if (actualCS == newCS)
            {
                this.bool_0 = true;
            }
            this.coordinateSystem_0 = actualCS;
            this.coordinateSystem_1 = newCS;
            ngeometry.VectorGeometry.Matrix3d basisVectorMatrix = actualCS.BasisVectorMatrix;
            ngeometry.VectorGeometry.Matrix3d matrix3d          = newCS.BasisVectorMatrix.Invert();
            ngeometry.VectorGeometry.Matrix3d matrix3d2         = matrix3d * basisVectorMatrix;
            double num  = actualCS.Origin.X - newCS.Origin.X;
            double num2 = actualCS.Origin.Y - newCS.Origin.Y;
            double num3 = actualCS.Origin.Z - newCS.Origin.Z;

            this.double_0  = matrix3d2.a00;
            this.double_1  = matrix3d2.a01;
            this.double_2  = matrix3d2.a02;
            this.double_3  = matrix3d2.a10;
            this.double_4  = matrix3d2.a11;
            this.double_5  = matrix3d2.a12;
            this.double_6  = matrix3d2.a20;
            this.double_7  = matrix3d2.a21;
            this.double_8  = matrix3d2.a22;
            this.double_9  = matrix3d.a00 * num + matrix3d.a01 * num2 + matrix3d.a02 * num3;
            this.double_10 = matrix3d.a10 * num + matrix3d.a11 * num2 + matrix3d.a12 * num3;
            this.double_11 = matrix3d.a20 * num + matrix3d.a21 * num2 + matrix3d.a22 * num3;
        }
Exemple #4
0
        public static Ellipse ConstructFromConjugateDiameters(Point M, Point P, Point Q)
        {
            Ellipse result;

            try
            {
                if (P.DistanceTo(M) > Q.DistanceTo(M))
                {
                    Point point = P.DeepCopy();
                    P = Q.DeepCopy();
                    Q = point.DeepCopy();
                }
                Vector3d vector3d  = new Vector3d(Q - M);
                Vector3d vector3d2 = new Vector3d(P - M);
                if (vector3d2.IsOrthogonalTo(vector3d))
                {
                    result = new Ellipse(M, vector3d, vector3d2);
                }
                else
                {
                    Plane plane = new Plane(M, P, Q);
                    plane.Normalize();
                    Matrix3d rotationMatrix = Matrix3d.RotationArbitraryAxis(plane.NormalVector, 1.5707963267948966);
                    Point    point2         = P.Rotate(M, rotationMatrix);
                    if (Vector3d.Angle(vector3d, new Vector3d(point2 - M)) > 1.5707963267948966)
                    {
                        point2 = -1.0 * (point2 - M) + M;
                    }
                    Point  midPoint = new Edge(point2, Q).MidPoint;
                    Circle circle   = new Circle(midPoint, M.DistanceTo(midPoint), plane.NormalVector);
                    Plane  plane2   = new Plane(midPoint, new Vector3d(point2 - midPoint), plane.NormalVector);
                    plane2.Normalize();
                    Edge   edge = plane2.method_5(circle);
                    double num  = Q.DistanceTo(edge.StartPoint);
                    double num2 = Q.DistanceTo(edge.EndPoint);
                    if (num < num2)
                    {
                        num  = num2;
                        num2 = Q.DistanceTo(edge.StartPoint);
                    }
                    Vector3d vector3d3 = new Vector3d(edge.EndPoint - M);
                    Vector3d vector3d4 = new Vector3d(edge.StartPoint - M);
                    if (vector3d4.Norm > vector3d3.Norm)
                    {
                        vector3d3 = new Vector3d(edge.StartPoint - M);
                        vector3d4 = new Vector3d(edge.EndPoint - M);
                    }
                    vector3d3.Norm = num;
                    vector3d4.Norm = num2;
                    Ellipse ellipse = new Ellipse();
                    ellipse.point_0 = M;
                    if (vector3d3.Norm >= vector3d4.Norm)
                    {
                        ellipse.vector3d_0 = vector3d3;
                        ellipse.vector3d_1 = vector3d4;
                    }
                    else
                    {
                        ellipse.vector3d_0 = vector3d4;
                        ellipse.vector3d_1 = vector3d3;
                    }
                    result = ellipse;
                }
            }
            catch (System.Exception ex)
            {
                throw new ArithmeticException("Rytz construction failed due to numerical problems:\n" + ex.Message);
            }
            return(result);
        }
Exemple #5
0
 public static Matrix3d RotationTaitBryan(double roll, double pitch, double yaw)
 {
     return(Matrix3d.smethod_3(Matrix3d.smethod_3(Matrix3d.RotationXAxis(roll), Matrix3d.RotationYAxis(pitch)), Matrix3d.RotationZAxis(yaw)));
 }
Exemple #6
0
 public static Matrix3d RotationEuler(double phi, double theta, double psi)
 {
     return(Matrix3d.smethod_3(Matrix3d.smethod_3(Matrix3d.RotationZAxis(psi), Matrix3d.RotationXAxis(theta)), Matrix3d.RotationZAxis(phi)));
 }
Exemple #7
0
 public static Matrix3d operator -(Matrix3d A)
 {
     return(Matrix3d.smethod_2(A, -1.0));
 }
Exemple #8
0
 public static Matrix3d operator -(Matrix3d A, Matrix3d B)
 {
     return(Matrix3d.smethod_1(A, B));
 }
Exemple #9
0
 public static Matrix3d operator *(double factor, Matrix3d A)
 {
     return(Matrix3d.smethod_2(A, factor));
 }
Exemple #10
0
 public Vector3d Rotate(Matrix3d rotationMatrix)
 {
     return(rotationMatrix * this);
 }