Problem:
I have a user generated polygon (via registering user\'s touches on screen) which can be simple or complex (complex means having unknown number of intersect
To use the JavaScript code you can check this answer:
The Objective-C interface in the JavascriptCore framework introduced with iOS 7 permits calling Objective-C methods from Javascript. For a great intro to these features, check out the 2013 WWDC introduction "Integrating JavaScript into Native Apps" session on Apple's developer network: https://developer.apple.com/videos/wwdc/2013/?id=615
It mentions JS->Objective-C but JSCore also works the other way around.
Otherwise as someone suggested it should be fairly easy to "translate" the JS code as it would just be mathematical calculations.