• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

PATH2D.contain() not working?  RSS feed

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Any reason why this "poly.contains(lat1, lon1)" is always returning false?
lat1,lon1 is definitely inside the polygon.
 
Greg Posey
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Console Output:

 
Marshal
Posts: 60142
188
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you tried displaying it on a panel? Please look what the closePath() method does. Also what the difference between lineTo() and moveTo() is. I think the point you are complaining about isn't actually inside the Path2D.
 
Sheriff
Posts: 23713
50
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Campbell Ritchie wrote:I think the point you are complaining about isn't actually inside the Path2D.



To me those four pairs of coordinates look like they form a rectangle, and the pair of coordinates being tested look like they're just about in the centre of that rectangle. So I'd agree with your comment about lineTo().
 
Campbell Ritchie
Marshal
Posts: 60142
188
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Paul Clapham wrote:. . . those four pairs of coordinates look like they form a rectangle . . .

They represent the corners of a rectangle, but the sides would have to be filled in too.
 
Rancher
Posts: 2835
96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
With 'path.moveTo(..)' you are not creating some boundary of a shape, that will make that some points are inside and some outside. You need some concrete lines or curves for that. For instance:
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!