kicad-developers team mailing list archive
Mailing list archive
Re: PCBNEW DRC with rotated rectangular pads (partial
jean-pierre charras - INPG <jean-pierre.charras@...>
Tue, 08 Sep 2009 15:06:13 +0200
Thunderbird 22.214.171.124 (Windows/20090812)
Jonas Diemer a écrit :
Am Dienstag, 8. September 2009 07:54:34 schrieb jean-pierre charras -
> But the better way is to extract (and simplify) from zone to zone
> outline DRC control the code that test the distance between 2 polygon
> that is exactly what is needed here.
> see zones_test_and_ combine_areas. cpp and
> BOARD::Test_ Drc_Areas_ Outlines_ To_Areas_ Outlines
You are right. I haven't looked into it yet. Currently (as of r1955
local extension), I used the TestForIntersection OfStraightLineSe
test rectangular/ trapezoidal pads. Seems to work well...
Its works well, but it is only one of 3 tests:
1 - test for a corner inside other polygon (obvioulsy ERROR DRC when happen)
2 - test segment intersection (obvioulsy ERROR DRC when happen)
3 - test segment distantes ( search for the smaller distance betweeb
each corner and segments of the other polygon) and creates an ERRROR DRC
only if too small.
this is what BOARD::Test_ Drc_Areas_ Outlines_ To_Areas_ Outlines does.
I yet have to extend this work to do the Oval/Circle vs Trapezoid
that can be done using GetClearanceBetween Segments( ) function.
Jean-Pierre: During my "analysis" of the code, I encountered a
checkLine(), which tests a line against some rectangle which is stored in
I think this function is really unintuitive (to be polite) as it uses
class members to do the test. Would you object if I removed that code
something cleaner (as the functions I mentioned above)? Or is there any
specific reason to do it with checkLine()?
I extracted it from a graphic library (LIBGRX) and checkLine() was a macro.
I am thinking it is hightly optimized function (DRC control can be time
consuming with bad optimized test functions)
and, like most of optimized functions, it can be hard to understand (to
In fact it is not very complex, but lacks of comments.
(a long time ago I had a look to it, but i did not write the necessary
comments. I apologize).
And using an intuitive code could have a cost in matter of calculation time.
I am not sure it is a good idea to change it.
But many DRC functions use an old code style (first code was written in
C) and many variables like m_xcliplo were global, and now members of DRC
most of these variable are parameters for one or 2 functions.
A better (and more understandable) code is to pass theses value as
parameters, not as DRC members.
If you some interest by DRC functions , you can have a look to freePCB.
the DRC approach (if i understood it) is something like:
The DRC function test only distance between very few basic objects( for
pcbnew: rectangle, circle and convex polygons for trapezoid pads)
each board object (pads, tracks, vias ...) on copper layers knows what
basic objects it uses and have a function like ReturnBasicObjectsList
that returns a list of
these basic objects to test (a track or an oval pad returns a rectangle
and 2 circles, a octogonal pad returns a polygon ... ) and the DRC
functions tests the min distance between the basic objects of 2 lists,
and does not know anything to the board objects themselves.
This is a more C++ approach.
Due to the complexity and particularities of zones outlines, zones have
a separate approach.
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
Grenoble Image Parole Signal Automatique (GIPSA - INPG)