You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
125 lines
2.9 KiB
125 lines
2.9 KiB
using System;
|
|
|
|
namespace Sog
|
|
{
|
|
// 1000倍
|
|
[Serializable]
|
|
public class Vector3IntFloat
|
|
{
|
|
public int x;
|
|
public int y;
|
|
public int z;
|
|
|
|
public Vector3IntFloat(int x, int y, int z)
|
|
{
|
|
this.x = x;
|
|
this.y = y;
|
|
this.z = z;
|
|
}
|
|
|
|
public Vector3IntFloat()
|
|
{
|
|
this.x = 0;
|
|
this.y = 0;
|
|
this.z = 0;
|
|
}
|
|
|
|
public Fixed64Vector3 ToFixed64()
|
|
{
|
|
Fixed64Vector3 vec = new Fixed64Vector3();
|
|
vec.x = x;
|
|
vec.y = y;
|
|
vec.z = z;
|
|
|
|
vec.x /= 1000;
|
|
vec.y /= 1000;
|
|
vec.z /= 1000;
|
|
|
|
return vec;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
return string.Format("{0} {1}", x, z);
|
|
}
|
|
}
|
|
|
|
[Serializable]
|
|
public class Vector2IntFloat
|
|
{
|
|
public int x;
|
|
public int y;
|
|
|
|
public Vector2IntFloat(int x, int y)
|
|
{
|
|
this.x = x;
|
|
this.y = y;
|
|
}
|
|
|
|
public Vector2IntFloat()
|
|
{
|
|
this.x = 0;
|
|
this.y = 0;
|
|
}
|
|
|
|
public bool IsZero()
|
|
{
|
|
return x == 0 && y == 0;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
return string.Format("{0} {1}", x, y);
|
|
}
|
|
|
|
public static long DistanceSquared(Vector2IntFloat value1, Vector2IntFloat value2)
|
|
{
|
|
return (value1.x - value2.x) * (value1.x - value2.x) + (value1.y - value2.y) * (value1.y - value2.y);
|
|
}
|
|
|
|
public static long Distance(Vector2IntFloat value1, Vector2IntFloat value2)
|
|
{
|
|
return ILMath.reckon_sqrt(DistanceSquared(value1, value2));
|
|
}
|
|
|
|
public static Vector2IntFloat operator +(Vector2IntFloat value1, Vector2IntFloat value2)
|
|
{
|
|
value1.x += value2.x;
|
|
value1.y += value2.y;
|
|
return value1;
|
|
}
|
|
public static Vector2IntFloat operator -(Vector2IntFloat value1, Vector2IntFloat value2)
|
|
{
|
|
value1.x -= value2.x;
|
|
value1.y -= value2.y;
|
|
return value1;
|
|
}
|
|
|
|
public static Vector2IntFloat operator *(Vector2IntFloat value ,int scaleFactor)
|
|
{
|
|
value.x *= scaleFactor;
|
|
value.y *= scaleFactor;
|
|
return value;
|
|
}
|
|
public static Vector2IntFloat operator *(int scaleFactor, Vector2IntFloat value)
|
|
{
|
|
value.x *= scaleFactor;
|
|
value.y *= scaleFactor;
|
|
return value;
|
|
}
|
|
|
|
public static Vector2IntFloat operator /(Vector2IntFloat value1, int divider)
|
|
{
|
|
value1.x /= divider;
|
|
value1.y /= divider;
|
|
return value1;
|
|
}
|
|
}
|
|
|
|
[Serializable]
|
|
public class DoublePoint
|
|
{
|
|
public Vector2IntFloat basePoint = new Vector2IntFloat();
|
|
public Vector2IntFloat beginPoint = new Vector2IntFloat();
|
|
}
|
|
}
|
|
|