[fpc-pascal] C translation question
Ryan Joseph
ryan at thealchemistguild.com
Tue Oct 25 05:56:53 CEST 2016
I just got back to this problem now. Yes, changing it to a while loop fixed the little bug and cleans things up in the translation for sure. Thanks for the tip.
> On Oct 24, 2016, at 3:20 AM, Bernd Oppolzer <bernd.oppolzer at t-online.de> wrote:
>
> int pnpoly (int nvert, float *vertx, float *verty, float testx, float testy)
> {
> int i, j, c = 0;
>
> i = 0, j = nvert-1;
>
> while (i < nvert)
> {
> if (((verty [i] > testy) != (verty [j] > testy)) &&
> (testx < (vertx[j] - vertx[i]) * (testy - verty [i])
> / (verty [j] - verty [i]) + vertx [i]))
> c = !c;
>
> j = i;
> i = i + 1;
> }
>
> return c;
> }
Regards,
Ryan Joseph
More information about the fpc-pascal
mailing list