向量点积

shader04_向量矩阵shader04_向量矩阵

向量叉积

shader04_向量矩阵

shader04_向量矩阵

 

矩阵

矩阵转置

shader04_向量矩阵

矩阵乘法

shader04_向量矩阵

shader04_向量矩阵

 class Triangle
    {
        PointF A, B, C;

        public Triangle(PointF A, PointF B, PointF C)
        {
            this.A = A;
            this.B = B;
            this.C = C;
        }

        public void Draw(Graphics g)
        {
            Pen pen = new Pen(Color.Red, 2);
            g.DrawLine(pen, A, B);
            g.DrawLine(pen, B, C);
            g.DrawLine(pen, C, A);
        }

        public void Rotate(int degrees)
        {
            float angle = (float)(degrees / 360.0f * Math.PI);//转化为弧度

            A.X = (float)(A.X * Math.Cos(angle) - A.Y * Math.Sin(angle));
            A.Y = (float)(A.X * Math.Sin(angle) + A.Y * Math.Cos(angle));

            B.X = (float)(B.X * Math.Cos(angle) - B.Y * Math.Sin(angle));
            B.Y = (float)(B.X * Math.Sin(angle) + B.Y * Math.Cos(angle));

            C.X = (float)(C.X * Math.Cos(angle) - C.Y * Math.Sin(angle));
            C.Y = (float)(C.X * Math.Sin(angle) + C.Y * Math.Cos(angle));
        }
    }

分别是沿XYZ轴旋转

shader04_向量矩阵

 

shader04_向量矩阵

shader04_向量矩阵

shader04_向量矩阵

 

shader04_向量矩阵

平移矩阵

shader04_向量矩阵

shader04_向量矩阵

相关文章:

  • 2021-12-20
  • 2021-06-17
  • 2021-05-08
  • 2022-12-23
  • 2022-01-18
  • 2021-12-04
猜你喜欢
  • 2021-10-02
  • 2021-09-02
  • 2021-11-30
  • 2022-02-18
  • 2021-06-28
  • 2021-12-31
  • 2022-02-08
相关资源
相似解决方案