Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / C++ to AGK for-next loop?

Author
Message
Scraggle
Moderator
21
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 15th Aug 2016 08:37 Edited at: 15th Aug 2016 09:16
[EDIT]
You can ignore this (unless you want the point in polygon code), the link that I provided explains the loop further down. It seems I did understand it correctly
[/EDIT]

Hi,

I've found some code to perform a point in polygon check but the code is in C++ and I want to convert it to AGK.
Most of the code is easily convertible but I don't really understand what is going on with the opening FOR statement.
Could somebody please help me out with this:

Assuming nvert is 5 then as I understand it ,
i would loop from 0 to 4
j would be 4 the first time through the loop but then i-1 each successive time.

Feel free to tell me that I'm wrong and point out the correct values so that I can convert it to AGK.

Thanks!

FYI, the full code is here
AGK V2 user - Tier 1 (mostly)
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 15th Aug 2016 18:47
Quote: "for (i = 0, j = nvert-1; i < nvert; j = i++) {"


i think its something like this

i = 0
j = nvert-1
do
if i < nvert
i=i+1
j =i
else
exit
endif
loop

AGK (Steam) V2.0.20 : Windows 10 Pro 64 Bit : AMD (16.3.2) Radeon R7 265 : Mac mini OS X 10.10 (Yosemite)

Login to post a reply

Server time is: 2024-11-25 04:32:25
Your offset time is: 2024-11-25 04:32:25