Computer Science Canada

Polygon Detection

Author:  Megatokyoguy [ Mon Nov 10, 2008 2:58 pm ]
Post subject:  Polygon Detection

Hey guys,

it's that time of year again, ISP time!
We're working on a project that functions like AutoCAD (we're calling it FreeCAD for now) and can already draw lines, change colours, move lines, redraw existing lines, calculate intersection points and snap lines to preexisting vertices.

We're currently working on polygons. Is there any other way (other than the long, having to check each vertice) way of seeing if a certain number of lines connect and form a polygon? E.g. If I connected 4 lines to form a rectangle, is there a simple function to check and see if the vertices are all interconnected?

I'd post the code but we've got tons, so if you need specifics just ask.
Thanks again!
FreeCAD Team

(That's what we're calling ourselves)


: