1.向量基本类
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace _3DTransform
{
class Vector4
{
public double x, y, z, w;
public Vector4() { }
public Vector4(double x, double y, double z, double w)
{
this.x = x;
this.y = y;
this.z = z;
this.w = w;
}
public Vector4(Vector4 v)
{
this.x = v.x;
this.y = v.y;
this.z = v.z;
this.w = v.w;
}
}
}
2.4X4阶矩阵运算类
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace _3DTransform
{
class matrix4X4
{
public double[,] pts;
public matrix4X4()
{
pts = new double[4, 4];
}
/// <summary>
/// 访问器便于获取矩阵中的元素
/// </summary>
/// <param name="i"></param>
/// <param name="j"></param>
/// <returns></returns>
public double this[int i, int j]
{
get
{
return pts[i - 1, j - 1];
}
set
{
pts[i - 1, j - 1] = value;
}
}
///