using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ShaderDemo
{
public class Vector3
{
public int x;
public int y;
public int z;
public Vector3(int x, int y, int z)
{
this.x = x;
this.y = y;
this.z = z;
}
public static Vector3 operator -(Vector3 A, Vector3 vtarger)
{
Vector3 v3 = Zero();
v3.x = A.x - vtarger.x;
v3.y = A.y - vtarger.y;
v3.z = A.z = vtarger.z;
return v3;
}
public static Vector3 operator +(Vector3 vtarger)
{
Vector3 v3 = Zero();
//v3.x = x + vtarger.x;
//v3.y = this.y + vtarger.y;
//v3.z = this.z = vtarger.z;
return v3;
}
public st
C#之自定义Vector3
最新推荐文章于 2024-07-14 10:21:56 发布
本文介绍了如何在C#中创建一个自定义的Vector3类,该类包含了向量的加减乘运算以及点积和差乘方法。通过这个类,可以方便地进行3D空间中的数学运算。
摘要由CSDN通过智能技术生成