Utilities/Matrix4.cs

(开头部分) 10KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace WindowsFormsApplication1.Utilities
{
    public struct Matrix4
    {
        public double e11, e12, e13, e14;
        public double e21, e22, e23, e24;
        public double e31, e32, e33, e34;
        public double e41, e42, e43, e44;

        public Matrix4(double _11, double _12, double _13, double _14,
                       double _21, double _22, double _23, double _24,
                       double _31, double _32, double _33, double _34,
                       double _41, double _42, double _43, double _44)
        {
            e11 = _11; e12 = _12; e13 = _13; e14 = _14;
            e21 = _21; e22 = _22; e23 = _23; e24 = _24;
            e31 = _31; e32 = _32; e33 = _33; e34 = _34;
            e41 = _41; e42 = _42; e43 = _43; e44 = _44;
        }

        public static Matrix4 RotateX(double theta)
        {
            double c = Math.Cos(theta);
            double s = Math.Sin(theta);
            return new Matrix4(1, 0, 0, 0,
                               0, c, s, 0,
                               0, -s, c, 0,
                               0, 0, 0, 1);
        }

        public static Matrix4 RotateY(double theta)
        {
            double c = Math.Cos(theta);
            double s = Math.Sin(theta);
            return new Matrix4(c, 0, -s, 0,
                               0, 1, 0, 0,
                               s, 0, c, 0,
                               0, 0, 0, 1);
        }

        public static Matrix4 RotateZ(double theta)
        {
            double c = Math.Cos(theta);
            double s = Math.Sin(theta);
            return new Matrix4(c, s, 0, 0,
                              -s, c, 0, 0,
                              0, 0, 1, 0,
                              0, 0, 0, 1);
        }

        public static Matrix4 Identity
        {
            get
            {
                return new Matrix4(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);
后面还有 226 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。