Hello Guest

Click on object detection help

  • 3 Replies
  • 6041 Views
Click on object detection help
« on: February 07, 2015, 05:43:15 »
I've been teaching my self java for a while now. I know i am doing some things really wrong and I have been playing with hexagon grids lately and i cant figure you how to get onClick to work right i would love some help.

Here is the github link to my project & where the problem is.: https://github.com/that1guy232/ZK/blob/master/src/com/that1guy232/ZK/Hexagon.java

*

Offline abcdef

  • ****
  • 336
Re: Click on object detection help
« Reply #1 on: February 07, 2015, 08:12:27 »
try and google for "check if a point is inside a hexagon", there are plenty of results telling you the maths to do this

Re: Click on object detection help
« Reply #2 on: February 07, 2015, 18:33:48 »
try and google for "check if a point is inside a hexagon", there are plenty of results telling you the maths to do this

Thanks, I came across http://www.codeproject.com/Tips/84226/Is-a-Point-inside-a-Polygon but i'm not quite sure i understand it. A little more help would be great!

*

Offline quew8

  • *****
  • 569
  • Because Square Eyes Look More Real
Re: Click on object detection help
« Reply #3 on: February 08, 2015, 16:28:23 »
What about this do you not understand? If it's the algorithm, and you want to understand it conceptually there there is a little paper written on it here: http://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/pnpoly.html.

But there is no need to understand the algorithm, you have been given a method in C that almost works in Java already. Change the "c" to a boolean variable. Change the method to return a boolean variable. Replace C pointers/number of vertices parameter with Java array(s).