fix: Fixes Point2D ctor (#1340)

This commit is contained in:
Kamron Batman 2023-02-13 23:28:23 -08:00 committed by GitHub
parent f24c6a08dd
commit 65c196a8ae
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 45 additions and 35 deletions

View file

@ -41,16 +41,27 @@ public struct Point2D
set => m_Y = value;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public Point2D(IPoint2D p) : this(p.X, p.Y)
{
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public Point2D(Point3D p) : this(p.X, p.Y)
{
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public Point2D(Point2D p) : this(p.X, p.Y)
{
}
public Point2D(int x, int y)
{
m_X = x;
m_Y = y;
}
public Point2D(Point2D p) : this(p.X, p.Y)
{
}
public bool Equals(Point2D other) => m_X == other.m_X && m_Y == other.m_Y;
public bool Equals(IPoint2D other) => m_X == other?.X && m_Y == other.Y;

View file

@ -54,10 +54,12 @@ public struct Point3D
{
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public Point3D(Point3D p) : this(p.X, p.Y, p.Z)
{
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public Point3D(Point2D p, int z) : this(p.X, p.Y, z)
{
}