kicad-developers team mailing list archive
Mailing list archive
Re: "Close in" work in pcbnew
Tim Hanson <sideskate@...>
Sat, 14 Feb 2009 09:29:44 -0500
> Any idea in welcomed.
Determining if a point is within a polygon is quick and easy - O(n).
At high zoom levels, you could just see if all for corners of the
screen's drawing rectangle are in a polygon; if they are,
then you fill the screen with the color for that polygon.
If not all are, then you do the winding algorithm to quickly clip the
poly onto the screen. That is: find all ordered intersections between
the screen drawing rectangle and the poly. This is easy since the
segments of the rectangle are parallel to the axes. Cull polygon
points to those that are inside and those that are outside the
rectangle. Cull the rectangle points to those that are inside and
those that are outside the polygon. Maintain winding order throughout
these operations. Draw the resulting series of vertices as a polygon.
> Jean-Pierre CHARRAS
> Maître de conférences
> Directeur d'études 2ieme année.
> Génie Electrique et Informatique Industrielle 2
> Institut Universitaire de Technologie 1 de Grenoble
> BP 67, 38402 St Martin d'Heres Cedex
> Recherche :
> GIPSA-LIS - INPG
> Rue de la Houille Blanche
> 38400 Saint Martin d'Heres