bilaldursun1 / nettopologysuite

Automatically exported from code.google.com/p/nettopologysuite
0 stars 0 forks source link

Typo in the NetTopologySuite.Geometries.Extents class #46

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
There is a small typo in the extents class on line 48

The line was
Double p2X = p1[Ordinates.X], p2Y = p1[Ordinates.Y];

but should be
Double p2X = p2[Ordinates.X], p2Y = p2[Ordinates.Y];

Cheers
Andy Cheetham

Original issue reported on code.google.com by AndySChe...@gmail.com on 14 Jul 2009 at 9:24

GoogleCodeExporter commented 9 years ago
did you referes to nts 1.7.3 (trunk) or nts2.0 (branch)?

Original comment by diegogu...@gmail.com on 15 Jul 2009 at 3:04

GoogleCodeExporter commented 9 years ago
Actually the code in 2.0 branch is this
            Double p1X = p1[Ordinates.X], p1Y = p1[Ordinates.Y];
            Double p2X = p1[Ordinates.X], p2Y = p1[Ordinates.Y];
I think code is correct

Original comment by diegogu...@gmail.com on 15 Jul 2009 at 3:07

GoogleCodeExporter commented 9 years ago

Double p1X = p1[Ordinates.X], p1Y = p1[Ordinates.Y];
Double p2X = p1[Ordinates.X], p2Y = p1[Ordinates.Y];

If the above code is correct, then the following will always be true.
p1X == p2X
and
p1Y == p2Y

If that is the case then the if statement that follows the above code will 
always 
return false (unless of course qX == p1X == p2X and qY == p1Y == p2Y)

if (((qX >= (p1X < p2X ? p1X : p2X)) && (qX <= (p1X > p2X ? p1X : p2X))) &&
   ((qY >= (p1Y < p2Y ? p1Y : p2Y)) && (qY <= (p1Y > p2Y ? p1Y : p2Y))))

The will always be false because qX can't be both greater than and less then 
p1X at 
the same time.

Original comment by AndySChe...@gmail.com on 15 Jul 2009 at 3:58

GoogleCodeExporter commented 9 years ago
Sorry I also meant to confirm the code I was looking at was from the 2.0 branch

Original comment by AndySChe...@gmail.com on 15 Jul 2009 at 4:22