93 lines
2.3 KiB
C#
93 lines
2.3 KiB
C#
using System;
|
|
|
|
namespace IDTF.Net
|
|
{
|
|
public class Point3
|
|
{
|
|
public Point3(float x, float y, float z)
|
|
{
|
|
this.X = x;
|
|
this.Y = y;
|
|
this.Z = z;
|
|
|
|
}
|
|
|
|
public float X { get; set; }
|
|
public float Y { get; set; }
|
|
public float Z { get; set; }
|
|
|
|
public override bool Equals(object obj)
|
|
{
|
|
if (obj is Point3 other)
|
|
{
|
|
return Math.Abs(this.X - other.X) < 0.000001
|
|
&& Math.Abs(this.Y - other.Y) < 0.000001
|
|
&& Math.Abs(this.Z - other.Z) < 0.000001;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
return String.Format("{0} {1} {2}",
|
|
this.X.ToString(Format.SixDecPlFormat),
|
|
this.Y.ToString(Format.SixDecPlFormat),
|
|
this.Z.ToString(Format.SixDecPlFormat));
|
|
}
|
|
}
|
|
|
|
public class Vector4 : Point3
|
|
{
|
|
|
|
public Vector4(float x, float y, float z, float w) : base(x, y, z)
|
|
{
|
|
this.W = w;
|
|
}
|
|
|
|
public float W { get; set; }
|
|
|
|
public override string ToString()
|
|
{
|
|
return String.Format("{0} {1} {2} {3}",
|
|
this.X.ToString(Format.SixDecPlFormat),
|
|
this.Y.ToString(Format.SixDecPlFormat),
|
|
this.Z.ToString(Format.SixDecPlFormat),
|
|
this.W.ToString(Format.SixDecPlFormat));
|
|
}
|
|
}
|
|
|
|
public class Int2
|
|
{
|
|
public Int2(int i0, int i1)
|
|
{
|
|
IntArray = new int[] { i0, i1 };
|
|
}
|
|
|
|
public int[] IntArray { get; private set; }
|
|
|
|
public override string ToString()
|
|
{
|
|
return String.Format("{0} {1}",
|
|
this.IntArray[0].ToString(),
|
|
this.IntArray[1].ToString());
|
|
}
|
|
}
|
|
public class Int3
|
|
{
|
|
public Int3(int i0, int i1, int i2)
|
|
{
|
|
IntArray = new int[] { i0, i1, i2 };
|
|
}
|
|
|
|
public int[] IntArray { get; private set; }
|
|
|
|
public override string ToString()
|
|
{
|
|
return String.Format("{0} {1} {2}",
|
|
this.IntArray[0].ToString(),
|
|
this.IntArray[1].ToString(),
|
|
this.IntArray[2].ToString());
|
|
}
|
|
}
|
|
}
|