0

i have 2 rectangles, i want to know left top point of intersect + width & height

//image
Rectangle rectangle1 = new Rectangle(121, 74, 614, 240);

//crop area
Rectangle rectangle2 = new Rectangle(40, -40, 240, 240);

Rectangle rectangle3 = new Rectangle();

if (rectangle1.IntersectsWith(rectangle2))
{
    rectangle3 = Rectangle.Intersect(rectangle2, rectangle1);
}

and in rectangle3 i have result {X = 121 Y = 74 Width = 159 Height = 126}

how?? why?? top left point is wrong, but width & height is ok

1 Answer 1

1

Have you tried drawing those? I think the answer is right.

1
  • Yes, the answer is right. OP needs some graph paper and a pencil. ;) Commented May 5, 2013 at 22:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.