public int DistanceTo(Point.Point2i p) { int tx = this.x - p.x; int ty = this.y - p.y; return(Loon.Utils.MathUtils .Sqrt(Loon.Utils.MathUtils.Mul(tx, tx) + Loon.Utils.MathUtils.Mul(ty, ty))); }
public int DistanceTo(Point.Point2i p1, Point.Point2i p2) { int tx = p2.x - p1.x; int ty = p2.y - p1.y; int u = Loon.Utils.MathUtils.Div( Loon.Utils.MathUtils.Mul(x - p1.x, tx) + Loon.Utils.MathUtils.Mul(y - p1.y, ty), Loon.Utils.MathUtils.Mul(tx, tx) + Loon.Utils.MathUtils.Mul(ty, ty)); int ix = p1.x + Loon.Utils.MathUtils.Mul(u, tx); int iy = p1.y + Loon.Utils.MathUtils.Mul(u, ty); int dx = ix - x; int dy = iy - y; return(Loon.Utils.MathUtils .Sqrt(Loon.Utils.MathUtils.Mul(dx, dx) + Loon.Utils.MathUtils.Mul(dy, dy))); }
public void Set(Point.Point2i p) { this.x = p.x; this.y = p.y; }
public Point2i(Point.Point2i p) { this.x = p.x; this.y = p.y; }