Hi, I have a rectangle inside another rectangle, how can I make to do like an IntersectWith method but just the outer rectangle Border?

Since one rectangle is inside the other it seems like it is always intersecting so I want to know how to tell the inner rectangle to do something only if it intersects with the outter rectangle border.

Thanks in advance

Recommended Answers

All 3 Replies

I belive you have the coords/position of one vertex of each rectangle; Having this and the lenght of the sides it's quite simple, I guess.
Taking as reference the top left vertex of the outter rectangle and comparing with the position of the top left vertex of the inner rectangle (considering the sides lenght) you are able to know if the edges are intersecting.

Ok,

Yeah that will work, I thought I might find a method that did that for me, just in case I resized the rectangles but that will work

Thanks

Just an idea; Don't know if there's a method defined for that too .. =)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.