42 lines
872 B
C#
42 lines
872 B
C#
namespace omp
|
|
{
|
|
public class Point { }
|
|
|
|
public class Point3D(int x, int y, int z) : Point
|
|
{
|
|
public int x = x, y = y, z = z;
|
|
|
|
public double DistanceTo(Point3D a)
|
|
{
|
|
double dx = x - a.x;
|
|
double dy = y - a.y;
|
|
double dz = z - a.z;
|
|
|
|
return Math.Sqrt(dx * dx + dy * dy + dz * dz);
|
|
}
|
|
|
|
public bool Equals(Point3D a)
|
|
{
|
|
return (x == a.x) && (y == a.y) && (z == a.z);
|
|
}
|
|
}
|
|
|
|
public class Point2D(int x, int y) : Point
|
|
{
|
|
public int x = x, y = y;
|
|
|
|
public double DistanceTo(Point2D a)
|
|
{
|
|
double dx = x - a.x;
|
|
double dy = y - a.y;
|
|
|
|
return Math.Sqrt(dx * dx + dy * dy);
|
|
}
|
|
|
|
public bool Equals(Point2D a)
|
|
{
|
|
return (x == a.x) && (x == a.y);
|
|
}
|
|
}
|
|
}
|