Example #1
0
        public static AxisStruct PosToAngle(AxisStruct start, double x, double y, double z, double n, double o, double a)
        {
            AxisStruct ag = new AxisStruct();

            ag.X     = x;
            ag.Y     = y;
            ag.Z     = z;
            ag.N     = n;
            ag.O     = o;
            ag.A     = a;
            ag.angle = PosToAngle(start.angle, x, y, z, n, o, a);
            return(ag);
        }
Example #2
0
 public AxisStruct(AxisStruct old)
 {
     angle = new double[6];
     X     = Y = Z = N = O = A;
     for (int i = 0; i < 6; i++)
     {
         angle[i] = old.angle[i];
     }
     X = old.X;
     Y = old.Y;
     Z = old.Z;
     N = old.N;
     O = old.O;
     A = old.A;
 }
Example #3
0
        public static AxisStruct AngleToPos(double[] angle)
        {
            AxisStruct ax = new AxisStruct();

            double[,] mx = (double[, ])Axis.Foper(angle);
            double[] pos = new double[3];
            ax.X = mx[0, 3];
            ax.Y = mx[1, 3];
            ax.Z = mx[2, 3];
            for (int i = 0; i < 6; i++)
            {
                ax.angle[i] = angle[i];
            }
            return(ax);
        }
Example #4
0
 public override bool Equals(object obj)
 {
     if (obj is AxisStruct)
     {
         AxisStruct a = (AxisStruct)obj;
         if (this.X != a.X)
         {
             return(false);
         }
         if (this.Y != a.Y)
         {
             return(false);
         }
         if (this.Z != a.Z)
         {
             return(false);
         }
         if (this.N != a.N)
         {
             return(false);
         }
         if (this.O != a.O)
         {
             return(false);
         }
         if (this.A != a.A)
         {
             return(false);
         }
         for (int i = 0; i < 6; i++)
         {
             if (this.angle[i] != a.angle[i])
             {
                 return(false);
             }
         }
         return(true);
     }
     return(false);
     //return base.Equals(obj);
 }
Example #5
0
 public static object DrawLine(AxisStruct g, AxisStruct g2, char color = 'r', int w = 1, int count = 15)
 {
     object[] output;
     //output = new object[4];
     //MWArray[] input;
     //output = new MWArray[4];
     //input = new MWArray[7];
     //input[0] = new MWNumericArray(g.angle);
     //input[1] = new MWNumericArray(g.getXYZ());
     //input[2] = new MWNumericArray(g.getNOA());
     //input[3] = new MWNumericArray(g2.getXYZ());
     //input[4] = new MWNumericArray(g2.getNOA());
     //input[5] = new MWCharArray(color);
     //input[6] = new MWNumericArray(w);
     output = Axis.LineQ(4, g.angle, g.getXYZ(), g.getNOA(), g2.getXYZ(), g2.getNOA(), color, (double)w);
     if (((double[, ])output[0])[0, 0] == 0)
     {
         return(output[3]);
     }
     return(null);
 }
Example #6
0
        public static List <double[]> PointToPointLineAngle(AxisStruct LastG, AxisStruct G, double range = 0.1, double deg = 1, bool MultThread = false)
        {
            double[]        v         = new double[6];
            double[]        d         = new double[6];
            double[]        lastag    = G.angle;
            List <double[]> anglelist = new List <double[]>();

            v[0] = LastG.X;
            v[1] = LastG.Y;
            v[2] = LastG.Z;
            v[3] = v[4] = v[5] = 0;
            d[0] = G.X;
            d[1] = G.Y;
            d[2] = G.Z;
            d[3] = d[4] = d[5] = 0;
            Line.Setup(v, d, range);
            if (Line.Count == 1)
            {
                v[0] = v[1] = v[2] = 0;
                d[0] = d[1] = d[2] = 0;
                v[3] = LastG.N;
                v[4] = LastG.O;
                v[5] = LastG.A;
                d[3] = G.N;
                d[4] = G.O;
                d[5] = G.A;
                Line.Setup(v, d, deg);
                v[0] = LastG.X;
                v[1] = LastG.Y;
                v[2] = LastG.Z;
                d[0] = G.X;
                d[1] = G.Y;
                d[2] = G.Z;
            }
            v[3] = LastG.N;
            v[4] = LastG.O;
            v[5] = LastG.A;
            d[3] = G.N;
            d[4] = G.O;
            d[5] = G.A;
            Line.Setup(v, d, Line.Count);
            G = new AxisStruct();
            while (!Line.isEmpty())
            {
                double[] list = Line.GetData();
                G.X = list[0];
                G.Y = list[1];
                G.Z = list[2];
                G.N = list[3];
                G.O = list[4];
                G.A = list[5];
                double[] pag = PosToAngle(LastG, G);
                if (pag != null)
                {
                    lastag = pag;
                }
                anglelist.Add(lastag);
                G.angle = lastag;
                LastG   = G;
            }
            return(anglelist);
        }
Example #7
0
 public static double[] PosToAngle(AxisStruct start, AxisStruct dest)
 {
     return(PosToAngle(start.angle, dest.X, dest.Y, dest.Z, dest.N, dest.O, dest.A));
 }
Example #8
0
 public static double[] PosToAngle(AxisStruct st)
 {
     return(PosToAngle(st.X, st.Y, st.Z, st.N, st.O, st.A));
 }