32 lines
757 B
C#
32 lines
757 B
C#
public struct float3(float x, float y, float z)
|
|
{
|
|
public float x = x;
|
|
public float y = y;
|
|
public float z = z;
|
|
|
|
public float r
|
|
{
|
|
get => x; set => x = value;
|
|
}
|
|
public float g
|
|
{
|
|
get => y; set => y = value;
|
|
}
|
|
public float b
|
|
{
|
|
get => z; set => z = value;
|
|
}
|
|
|
|
public static float3 operator -(float3 a, float3 b) => new float3(a.x - b.x, a.y - b.y, a.z - b.y);
|
|
|
|
public static float3 cross(float3 a, float3 b) => new float3(a.y * b.z - a.z * b.y, a.z * b.x - a.x * b.z, a.x * b.y - a.y * b.x);
|
|
|
|
public static float dot(float3 a, float3 b) => a.x * b.x + a.y * b.y + a.z * b.z;
|
|
|
|
}
|
|
|
|
public struct float2(float x, float y)
|
|
{
|
|
public float x = x;
|
|
public float y = y;
|
|
} |