天道酬勤,学无止境

OBB

C#实现OBB碰撞算法

向量类Vec3public class Vec3 { public float X { get; set; } public float Y { get; set; } public float Z { get; set; } public Vec3() { } public Vec3(float _x,float _y,float _z) { X = _x; Y = _y; Z = _z; } #region 操作符 public static Vec3 operator ^(Vec3 num1, Vec3 num2) { Vec3 v = new Vec3(); v.X = num1.Y * num2.Z - num1.Z * num2.Y; v.Y = num1.Z * num2.X - num1.X * num2.Z; v.Z = num1.X * num2.Y - num1.Y * num2.X; return v; } public static Vec3 operator -(Vec3 num1, Vec3 num2) { Vec3 v = new Vec3(); v.X = num1.X-num2.X; v.Y = num1.Y - num2.Y; v.Z = num1.Z - num2.Z; return v; } public static float

2021-05-18 14:31:23    分类:博客    c#   OBB