forums

TNT Basic Forums > Programming Q&A
Point in Polygon
< Last Thread     Next Thread >
Author
Thread        Post A Reply

02-12-2006 18:31

Posted by:
Jacob

Location:
San Francisco, CA

Click Here to Email Jacob   Find more posts by Jacob

Does TNT Basic have a point in polygon feature?
If not, how would I do this?

And how do I test if an oval or circle is touching a polygon?

And one more thing, how about testing if a polygon is touching another polygon?

02-12-2006 23:36

Posted by:
allnodcoms

Location:
hertfordshire (England)

Click Here to Email allnodcoms   Find more posts by allnodcoms

There is 'In Map Polygon'...

...but if you are talking about a general polygon, drawn to a screen, then no TNT doesn't support a test of this type.

How to implement it? It's a relatively simple algorithm to explain, but a bum to implement. Your best bet is to post this as a feature request, it would fit nicely with your request for loading polys from an array. There is a call in the underlying QT API that would solve the problem, and this could be implemented fairly easily. If you want this sort of call now then it can be done but you are talking about scan conversion algorithms, and it's a lot of math...

An Oval touching a poly? Forget it... Again it can be done, but it's a far too specific thing to be worrying about, and this is SERIOUS math!

Two overlapping polys? There is an underlying call which tells you if two regions overlap, anything more than that and you are back to the above question. If you are looking for points of intersection then it is really not going to happen, at least for a long time.

If you would like to know how to do the point in poly test then drop me a line and I'll mail over some theory, I've done this sort of thing before (in C) and it's not pretty.

Danny (nods)

All times are GMT        Post A Reply

Forum Jump:
< Last Thread     Next Thread >

< Contact Us - TNT Basic >

Powered by: vBulletin Lite Version 1.0.1 Lite
Copyright © Jelsoft Enterprises Limited 2000.