Esempio n. 1
0
 private void btn_Change_Click(object sender, EventArgs e)
 {
     if (ChosenLine != null)
     {
         Int32.TryParse(tb1_Z.Text, out ChosenLine.A.Z);
         ChosenLine.Local_A.Z = ChosenLine.A.Z;
         Int32.TryParse(tb2_Z.Text, out ChosenLine.B.Z);
         ChosenLine.Local_B.Z = ChosenLine.B.Z;
         ChosenLine.FindParams();
     }
     //DrawAllLines();
 }
Esempio n. 2
0
        private static void MakeOperation(float[,] operation, Line2D ln2d, OperationType type)
        {
            float xcoord  = (((float)ln2d.A.X) * operation[0, 0] + ((float)ln2d.A.Y) * operation[1, 0] + ((float)ln2d.A.Z) * operation[2, 0] + operation[3, 0]);
            float ycoord  = (((float)ln2d.A.X) * operation[0, 1] + ((float)ln2d.A.Y) * operation[1, 1] + ((float)ln2d.A.Z) * operation[2, 1] + operation[3, 1]);
            float zcoord  = (((float)ln2d.A.X) * operation[0, 2] + ((float)ln2d.A.Y) * operation[1, 2] + ((float)ln2d.A.Z) * operation[2, 2] + operation[3, 2]);
            float OKcoord = (((float)ln2d.A.X) * operation[0, 3] + ((float)ln2d.A.Y) * operation[1, 3] + ((float)ln2d.A.Z) * operation[2, 3] + operation[3, 3]);

            if (type == OperationType.Change)
            {
                ln2d.A.X       = (int)(xcoord / OKcoord);
                ln2d.A.Y       = (int)(ycoord / OKcoord);
                ln2d.A.Z       = (int)(zcoord / OKcoord);
                ln2d.Local_A.X = (int)(xcoord / OKcoord);
                ln2d.Local_A.Y = (int)(ycoord / OKcoord);
                ln2d.Local_A.Z = (int)(zcoord / OKcoord);
            }
            else
            {
                ln2d.Local_A.X = (int)(xcoord / OKcoord);
                ln2d.Local_A.Y = (int)(ycoord / OKcoord);
                ln2d.Local_A.Z = (int)(zcoord / OKcoord);
            }
            xcoord  = (((float)ln2d.B.X) * operation[0, 0] + ((float)ln2d.B.Y) * operation[1, 0] + ((float)ln2d.B.Z) * operation[2, 0] + operation[3, 0]);
            ycoord  = (((float)ln2d.B.X) * operation[0, 1] + ((float)ln2d.B.Y) * operation[1, 1] + ((float)ln2d.B.Z) * operation[2, 1] + operation[3, 1]);
            zcoord  = (((float)ln2d.B.X) * operation[0, 2] + ((float)ln2d.B.Y) * operation[1, 2] + ((float)ln2d.B.Z) * operation[2, 2] + operation[3, 2]);
            OKcoord = (((float)ln2d.B.X) * operation[0, 3] + ((float)ln2d.B.Y) * operation[1, 3] + ((float)ln2d.B.Z) * operation[2, 3] + operation[3, 3]);
            if (type == OperationType.Change)
            {
                ln2d.B.X       = (int)(xcoord / OKcoord);
                ln2d.B.Y       = (int)(ycoord / OKcoord);
                ln2d.B.Z       = (int)(zcoord / OKcoord);
                ln2d.Local_B.X = (int)(xcoord / OKcoord);
                ln2d.Local_B.Y = (int)(ycoord / OKcoord);
                ln2d.Local_B.Z = (int)(zcoord / OKcoord);
            }
            else
            {
                ln2d.Local_B.X = (int)(xcoord / OKcoord);
                ln2d.Local_B.Y = (int)(ycoord / OKcoord);
                ln2d.Local_B.Z = (int)(zcoord / OKcoord);
            }
            ln2d.FindParams();
        }