Find overlapping rectangles

Discussion in 'AutoCAD' started by Alan Henderson @ A'cad Solutions, Mar 22, 2005.

  1. BlankI am trying to find a more elegant method of determining overlapping rectangles.
    I save Starting X, Ending X, Starting Y and Ending Y for each rectangle (1st is HORZ_, 2nd is NEXT_)
    All I can think of so far seems to be cumbersome and doesn't work

    (if (or
    (and (< HORZ_START NEXT_START HORZ_END) (< HORZ_BOT NEXT_BOT HORZ_TOP))
    (and (< HORZ_START NEXT_START HORZ_END) (< NEXT_BOT HORZ_BOT NEXT_TOP))
    (and (< NEXT_START HORZ_START NEXT_END) (< HORZ_BOT NEXT_BOT HORZ_TOP))
    (and (< NEXT_START HORZ_START NEXT_END) (< NEXT_BOT HORZ_BOT NEXT_TOP))
    )
    (princ "\nOverlapping")
    (princ "\nOkay")
    )

    I need to know if the rectangles overlap or if 1 is totally inside the other.
    Rectangles that touch are okay.

    Any ideas or help is greatly appreciated....
    Alan
     
    Alan Henderson @ A'cad Solutions, Mar 22, 2005
    #1
  2. Alan,

    Can you post some images about this?
     
    Luis Esquivel, Mar 22, 2005
    #2
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.