Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jerdew5/orbworks.com/forum/includes/bbcode.php on line 472
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3368: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3370: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3371: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3372: Cannot modify header information - headers already sent by (output started at /includes/bbcode.php:472)
OrbWorks Community Forum • View topic - Polygon-hotspots - how it works

Polygon-hotspots - how it works

Discuss PocketC for CE (including Desktop Edition)

Postby darwin on Sun Dec 10, 2000 5:42 pm

I have posted in earlier days a question, how I could check if a point is inside of a polygon, or outside. Well - it's not a real problem. At least not, if you don't want to write such a function (I have not).
The solution, how to handle this problem can be found at
http://strange-phenomenom.de/newp/pocketc_tips_polc.htm
- it's a preview on my new homepage. There are many mistakes, etc.

Short info:
Take a point outside the Polygon you want to check, and draw a line to the point you want to check, and count how often the line crosses the polygon's line. If the number is even, the point is outside, if it is odd, it is inside. Of course the polygon must be closed.
<img src="http://www.strange-phenomenom.de/newp/images/tips/austr01.gif" border=0>

Just need someone to write the code :) (i can only guess who will do that)
Eike

PS: if you take a look at my new homepage layout, you can tell me what you think about it.
PPS.: By the way - where's Ian? I haven't seen him on the members page of the new Board.
darwin
 
Posts: 71
Joined: Tue Dec 05, 2000 12:04 pm
Location: Germany

Postby ianf on Mon Dec 11, 2000 7:32 am

Hi Darwin, I expect the maths is contained in some programming faq so I will check. I will also ask my wife as she's a maths teacher.

I have been checking the board but had not bothered to register yet as I hate registration screens.

I have been cooling my heels waiting for V3 to speed up (graphics are not fast & my file handling is V.slow. My assumption is that there's some non-optimised code which Kevin has not had time to tweek.

am collecting C++ resources (game sources, books and posts as I need to start a new game soon. Space Treker registrations are healthy enough (approaching 300) but I can't rely on one game to keep on rolling & the type of game I really want to do needs speed.

Ian
ianf
 
Posts: 92
Joined: Mon Dec 11, 2000 7:25 am
Location: United Kingdom

Postby darwin on Mon Dec 11, 2000 10:59 am

Well - I woke up today at 4 o'clock - and made a mistake. I thought about the problem. I couldn't resist to check it and at 6 o'clock (I tried to take some sleep till 5:20 - but no chance) I finished the first step for a line-cross function: a basic applet:
<img src="http://www.strange-phenomenom.de/newp/images/sccap/slice.gif" border=0>
The red lines are crossing the black line, the green does not.
The numbers are just for debuging (I had to make some correction due to a mistake in my math, and before school, I had no time to check the +/-signs (the only mistake)).
I want to start to explain which way I took:
You can easyly find the crossing point of two linear functions f(x)=x*m + t;
t is the y-correction, m the increment (?don't know the english word (for both)).
The first two numbers (I have two lines of course) are m, the next two numbers are t and the last two are x and y of the crossing - or where they would cross if they were longer.

I will continue working on this. It is a very interesting topic because you can solve alot of graphical problems in PocketC with Polygons (because they are fast to draw).

Eike
darwin
 
Posts: 71
Joined: Tue Dec 05, 2000 12:04 pm
Location: Germany

Postby darwin on Mon Dec 11, 2000 12:07 pm

The math explanation can be found at:
http://strange-phenomenom.de/newp/pocketc_tips_crli.htm
have a nice day :)

Eike
darwin
 
Posts: 71
Joined: Tue Dec 05, 2000 12:04 pm
Location: Germany


Return to PocketC for CE

Who is online

Users browsing this forum: No registered users and 2 guests

cron