Click on object detection help

Started by that1guy232, February 07, 2015, 05:43:15

Previous topic - Next topic

that1guy232

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

abcdef

try and google for "check if a point is inside a hexagon", there are plenty of results telling you the maths to do this

that1guy232

Quote from: abcdef 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

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!

quew8

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).