コード例 #1
0
ファイル: AphineWork.cs プロジェクト: XeonSun/CGLab5
 public static void Move(IAphine cyl, double dx, double dy, double dz)
 {
     double[,] m = { { 1, 0, 0, dx },
                     { 0, 1, 0, dy },
                     { 0, 0, 1, dz },
                     { 0, 0, 0,  1 } };
     cyl.aphineMatrix = multMatrix(m, cyl.aphineMatrix);
 }
コード例 #2
0
ファイル: AphineWork.cs プロジェクト: XeonSun/CGLab5
 public static void Scale(IAphine cyl, double kx, double ky, double kz)
 {
     double[,] m = { { kx,  0,  0, 0 },
                     {  0, ky,  0, 0 },
                     {  0,  0, kz, 0 },
                     {  0,  0,  0, 1 } };
     cyl.aphineMatrix = multMatrix(m, cyl.aphineMatrix);
 }
コード例 #3
0
ファイル: AphineWork.cs プロジェクト: XeonSun/CGLab5
 public static void RotateZ(IAphine cyl, double gamma)
 {
     double[,] m = { { Math.Cos(gamma), -Math.Sin(gamma), 0, 0 },
                     { Math.Sin(gamma), Math.Cos(gamma),  0, 0 },
                     {               0,                0, 1, 0 },
                     {               0,                0, 0, 1 } };
     cyl.aphineMatrix = multMatrix(m, cyl.aphineMatrix);
 }
コード例 #4
0
ファイル: AphineWork.cs プロジェクト: XeonSun/CGLab5
 public static void RotateY(IAphine cyl, double beta)
 {
     double[,] m = { { Math.Cos(beta),  0, Math.Sin(beta), 0 },
                     {               0, 1,              0, 0 },
                     { -Math.Sin(beta), 0, Math.Cos(beta), 0 },
                     {               0, 0,              0, 1 } };
     cyl.aphineMatrix = multMatrix(m, cyl.aphineMatrix);
 }
コード例 #5
0
ファイル: AphineWork.cs プロジェクト: XeonSun/CGLab5
 public static void RotateX(IAphine cyl, double alpha)
 {
     double[,] m = { { 1,               0,                0, 0 },
                     { 0, Math.Cos(alpha), -Math.Sin(alpha), 0 },
                     { 0, Math.Sin(alpha), Math.Cos(alpha),  0 },
                     { 0,               0,                0, 1 } };
     cyl.aphineMatrix = multMatrix(m, cyl.aphineMatrix);
 }
コード例 #6
0
ファイル: Form1.cs プロジェクト: XeonSun/CGLab5
        //Кнопка применить
        private void button2_Click(object sender, EventArgs e)
        {
            double  v        = 0;
            IAphine selected = cyl;

            if (Double.TryParse(textBox_value.Text, out v))
            {
                if (radioButton_Obj.Checked)
                {
                    selected = cyl;
                }
                if (radioButton_Cam.Checked)
                {
                    selected = cam;
                }

                if (radioButton_Move.Checked && radioButton_X.Checked)
                {
                    AphineWork.Move(selected, v, 0, 0);
                }
                if (radioButton_Move.Checked && radioButton_Y.Checked)
                {
                    AphineWork.Move(selected, 0, v, 0);
                }
                if (radioButton_Move.Checked && radioButton_Z.Checked)
                {
                    AphineWork.Move(selected, 0, 0, v);
                }

                if (radioButton_Scale.Checked && radioButton_X.Checked)
                {
                    AphineWork.Scale(selected, v, 1, 1);
                }
                if (radioButton_Scale.Checked && radioButton_Y.Checked)
                {
                    AphineWork.Scale(selected, 1, v, 1);
                }
                if (radioButton_Scale.Checked && radioButton_Z.Checked)
                {
                    AphineWork.Scale(selected, 1, 1, v);
                }

                if (radioButton_Rotate.Checked && radioButton_X.Checked)
                {
                    AphineWork.RotateX(selected, v / 100);
                }
                if (radioButton_Rotate.Checked && radioButton_Y.Checked)
                {
                    AphineWork.RotateY(selected, v / 100);
                }
                if (radioButton_Rotate.Checked && radioButton_Z.Checked)
                {
                    AphineWork.RotateZ(selected, v / 100);
                }
                //g.DrawImage(render.Draw(int.Parse(textBox_cadrX.Text), int.Parse(textBox_cadrY.Text)), 0, 0);
            }
            g.DrawImage(render.Draw(int.Parse(textBox_cadrX.Text), int.Parse(textBox_cadrY.Text)), 0, 0);
        }