O
ofiras
Hello everyone,
I have a problem that I couldn't solve. What I have to do is a
function that will get an array of points (the polygon), a point and
int variable that will represent a side I need to check. This function
has to check if the point will come across the polygon if it will go
in a certain direction (it can be 45 degrees up to the left or right).
The function must do this without checking every possibility in the
dot's course. The only solution I could think of what making a line
that goes through the dot, in 45 degrees up, and check if there is a
collision between the line and the polygon at the direction I want to
check.
This is a demonstration of what it has to do: http://i50.tinypic.com/2ez73nc.jpg
- in this case the function should return true.
http://i50.tinypic.com/xqc4mv.jpg - in this case the function should
return false.
(in both cases the line was to the left, but it can also be to the
right)
Is there anyone who knows how can I do it?
Please help,
Ofir.
I have a problem that I couldn't solve. What I have to do is a
function that will get an array of points (the polygon), a point and
int variable that will represent a side I need to check. This function
has to check if the point will come across the polygon if it will go
in a certain direction (it can be 45 degrees up to the left or right).
The function must do this without checking every possibility in the
dot's course. The only solution I could think of what making a line
that goes through the dot, in 45 degrees up, and check if there is a
collision between the line and the polygon at the direction I want to
check.
This is a demonstration of what it has to do: http://i50.tinypic.com/2ez73nc.jpg
- in this case the function should return true.
http://i50.tinypic.com/xqc4mv.jpg - in this case the function should
return false.
(in both cases the line was to the left, but it can also be to the
right)
Is there anyone who knows how can I do it?
Please help,
Ofir.