dcsimg
A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: area of intersection between rotated rectangles

  1. #1
    Senior Member
    Join Date
    Jan 2003
    Location
    Austin, TX
    Posts
    297

    area of intersection between rotated rectangles

    hi guys
    How would I go about finding the area of the intersection between two rectangles that may be rotated relative to each other? The information I have to work with is their coordinates (one centered, one top left aligned, but it wouldn't be hard to find the other center point if that's necessary), the width and height of each rectangle, and the angles they are rotated at.

  2. #2
    Senior Member rachil0's Avatar
    Join Date
    Jul 2007
    Location
    Columbus, OH.
    Posts
    465
    One solution could be to (i) use the sutherland hodgman algorithm to clip one rectangle within the other, and then (ii) use greens theorem/the surveyors formula to compute the area. The second step is easy, but the first step requires a little bit of care to program correctly.

    There might be a simpler solution, so be sure to ask around at some other places.

  3. #3
    Senior Member realMakc's Avatar
    Join Date
    Oct 2002
    Posts
    915
    or use drawing api + blending modes + bitmap.draw + getColorBoundsRect per every scan line to estimate the area.
    who is this? a word of friendly advice: FFS stop using AS2

  4. #4
    var x:Number = 1; x /= 0;
    Join Date
    Dec 2004
    Posts
    549
    find the two intersection points and the two points for the corners, and then divide it into two triangles. That will make it a lot simpler.

  5. #5
    Member
    Join Date
    Feb 2010
    Posts
    59
    This is really a Calculus problem, more specifically a study called INTEGRATION.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center