Example #1
0
        public int Distance(ref CCPointI p)
        {
            var hside = X - p.X;
            var vside = Y - p.Y;

            return((int)Math.Sqrt(hside * hside + vside * vside));
        }
Example #2
0
        public int DistanceSQ(ref CCPointI p)
        {
            var hside = X - p.X;
            var vside = Y - p.Y;

            return(hside * hside + vside * vside);
        }
Example #3
0
        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));
        }
Example #4
0
        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);
        }
Example #5
0
 public void ExpandToPoint(ref CCPointI point)
 {
     ExpandToPoint(point.X, point.Y);
 }
Example #6
0
 public void ExpandToCircle(ref CCPointI point, int radius)
 {
     ExpandToCircle(point.X, point.Y, radius);
 }
Example #7
0
 public bool Equals(ref CCPointI p)
 {
     return X == p.X && Y == p.Y;
 }
Example #8
0
        public int DistanceSQ(ref CCPointI p)
        {
            var hside = X - p.X;
            var vside = Y - p.Y;

            return hside * hside + vside * vside;
        }
Example #9
0
        public int Distance(ref CCPointI p)
        {
            var hside = X - p.X;
            var vside = Y - p.Y;

            return (int)Math.Sqrt(hside * hside + vside * vside);
        }
Example #10
0
 public void ExpandToPoint(ref CCPointI point)
 {
     ExpandToPoint(point.X, point.Y);
 }
Example #11
0
 public void ExpandToCircle(ref CCPointI point, int radius)
 {
     ExpandToCircle(point.X, point.Y, radius);
 }
Example #12
0
 public bool Equals(ref CCPointI p)
 {
     return(X == p.X && Y == p.Y);
 }