49 lines
1.1 KiB
C#
49 lines
1.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Runtime.CompilerServices;
|
|
using System.Text;
|
|
|
|
namespace StgSharp.Math
|
|
{
|
|
public static unsafe partial class Vector
|
|
{
|
|
public static Vec3D To3D(this Vec2D vec)
|
|
{
|
|
return new Vec3D(vec.X, vec.Y, 0.0f);
|
|
}
|
|
|
|
public static Vec4D To4D(this Vec2D Vec)
|
|
{
|
|
return new Vec4D(Vec.X, Vec.Y, 0, 0);
|
|
}
|
|
|
|
public static Vec4D To4D(this Vec3D vec)
|
|
{
|
|
return new Vec4D(vec.X, vec.Y, vec.Z, 0);
|
|
}
|
|
|
|
public static Vec2D To2D(Vec3D vec, CordinatePlain plain)
|
|
{
|
|
switch (plain)
|
|
{
|
|
case CordinatePlain.XY:
|
|
return new Vec2D(vec.X, vec.Y);
|
|
break;
|
|
case CordinatePlain.YZ:
|
|
return new Vec2D(vec.Y, vec.Z);
|
|
break;
|
|
case CordinatePlain.XZ:
|
|
return new Vec2D(vec.X, vec.Z);
|
|
break;
|
|
default:
|
|
return default(Vec2D);
|
|
break;
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|