public int Distance(ref CCPointI p) { var hside = X - p.X; var vside = Y - p.Y; return((int)Math.Sqrt(hside * hside + vside * vside)); }
public int DistanceSQ(ref CCPointI p) { var hside = X - p.X; var vside = Y - p.Y; return(hside * hside + vside * vside); }
public CCBoundingBoxI Transform(CCAffineTransform matrix) { var top = MinY; var left = MinX; var right = MaxX; var bottom = MaxY; var topLeft = new CCPointI(left, top); var topRight = new CCPointI(right, top); var bottomLeft = new CCPointI(left, bottom); var bottomRight = new CCPointI(right, bottom); matrix.Transform(ref topLeft.X, ref topLeft.Y); matrix.Transform(ref topRight.Y, ref topRight.Y); matrix.Transform(ref bottomLeft.X, ref bottomLeft.Y); matrix.Transform(ref bottomRight.X, ref bottomRight.Y); int minX = Math.Min(Math.Min(topLeft.X, topRight.X), Math.Min(bottomLeft.X, bottomRight.X)); int maxX = Math.Max(Math.Max(topLeft.X, topRight.X), Math.Max(bottomLeft.X, bottomRight.X)); int minY = Math.Min(Math.Min(topLeft.Y, topRight.Y), Math.Min(bottomLeft.Y, bottomRight.Y)); int maxY = Math.Max(Math.Max(topLeft.Y, topRight.Y), Math.Max(bottomLeft.Y, bottomRight.Y)); return(new CCBoundingBoxI(minX, minY, maxX, maxY)); }
public CCBoundingBoxI Transform(ref CCAffineTransform matrix) { var top = MinY; var left = MinX; var right = MaxX; var bottom = MaxY; var topLeft = new CCPointI(left, top); var topRight = new CCPointI(right, top); var bottomLeft = new CCPointI(left, bottom); var bottomRight = new CCPointI(right, bottom); matrix.Transform(ref topLeft.X, ref topLeft.Y); matrix.Transform(ref topRight.X, ref topRight.Y); matrix.Transform(ref bottomLeft.X, ref bottomLeft.Y); matrix.Transform(ref bottomRight.X, ref bottomRight.Y); int minX = Math.Min(Math.Min(topLeft.X, topRight.X), Math.Min(bottomLeft.X, bottomRight.X)); int maxX = Math.Max(Math.Max(topLeft.X, topRight.X), Math.Max(bottomLeft.X, bottomRight.X)); int minY = Math.Min(Math.Min(topLeft.Y, topRight.Y), Math.Min(bottomLeft.Y, bottomRight.Y)); int maxY = Math.Max(Math.Max(topLeft.Y, topRight.Y), Math.Max(bottomLeft.Y, bottomRight.Y)); return new CCBoundingBoxI(minX, minY, maxX, maxY); }
public void ExpandToPoint(ref CCPointI point) { ExpandToPoint(point.X, point.Y); }
public void ExpandToCircle(ref CCPointI point, int radius) { ExpandToCircle(point.X, point.Y, radius); }
public bool Equals(ref CCPointI p) { return X == p.X && Y == p.Y; }
public int DistanceSQ(ref CCPointI p) { var hside = X - p.X; var vside = Y - p.Y; return hside * hside + vside * vside; }
public int Distance(ref CCPointI p) { var hside = X - p.X; var vside = Y - p.Y; return (int)Math.Sqrt(hside * hside + vside * vside); }
public bool Equals(ref CCPointI p) { return(X == p.X && Y == p.Y); }