Re: Problem with "IntersectsWith" function in GDI+

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



If the builtin behaviour doesn't suit then its just a trivial coding
exercise to do your own intersection test with whatever boundary rules you
like.

Cheers
Doug Forster

"Ranjit" <Ranjit@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:9E354B34-0D2B-423A-85D3-BFE8BD6F517A@xxxxxxxxxxxxxxxx
Hi All,

I am working on .Net Framework 2.0 (Graphics module). I am facing a
strange problem w.r.t IntersectsWith function which is used to determine
whether two given rectangles intersect with each other (or) not.

I have two cases where the rectangles in both the cases touch
exactly with one another, but the result of the function returns

FALSE in case 1
&
TRUE in case 2.


Case-1
Dim firstRectangleF As New RectangleF(720.7F, 618.0F, 30.7F, 12.2F)
Dim secondRectangleF As New RectangleF(690.0F, 618.0F, 30.7F, 12.2F)

MessageBox.Show(firstRectangleF.IntersectsWith(secondRectangleF))


ANSWER: Returns FALSE







Case-2
Dim firstRectangleF As New RectangleF(782.1F, 618.0F, 30.7F, 12.2F)
Dim secondRectangleF As New RectangleF(751.4F, 618.0F, 30.7F, 12.2F)

MessageBox.Show(firstRectangleF.IntersectsWith(secondRectangleF))



ANSWER: Returns TRUE



In both the cases, rectangles are placed side by side(Y is constant),
with one edge overlapping. Draw the same coordinate rectangles on a
window
for simulation.



Please, Can any one can help what could be the actual problem, how can we
avoid this problem?


.



Relevant Pages

  • Re: fmincon
    ... The rectangles are alligned to axes so the code of calculating the intersection is o'k i guess. ... Excuse me for maybe stupid question: -A as sign to empty intersection is given to implement say constraint c< 0? ... As far as I understood from Alex, ...
    (comp.soft-sys.matlab)
  • Re: fmincon
    ... The rectangles are alligned to axes so the code of calculating the intersection is o'k i guess. ... Excuse me for maybe stupid question: -A as sign to empty intersection is given to implement say constraint c< 0? ... You can transform it into a equivalent linear constraints, however the equivalent number of linear equations should be much larger. ...
    (comp.soft-sys.matlab)
  • Re: Find the intersection of two rectangles
    ... Unless the rectangles are axis-aligned, ... the general case of Convex Polygon Intersection. ... And the intersection is empty unless ...
    (comp.lang.c)
  • Re: simple measure theory question
    ... union, intersection, difference, symmetric difference and complement. ... or does disjoint mean measure zero intersection? ... rectangles can be any as you have described ... be elementary for being the intersection of two elementary sets. ...
    (sci.math)