PDF3D/IDTF.Net/BasicTypes.cs
2023-05-05 17:08:24 +08:00

87 lines
2.1 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 bool Equals(Point3 other)
{
return this.X == other.X && this.Y == other.Y && this.Z == other.Z;
}
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());
}
}
}