← Back to team overview

kicad-developers team mailing list archive

Re: PCBNEW DRC with rotated rectangular pads (partial

 

Jonas Diemer a écrit :


Am Dienstag, 8. September 2009 07:54:34 schrieb jean-pierre charras - INPG:
> 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 and my local extension), I used the TestForIntersection OfStraightLineSe gments() to
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 tests, but
that can be done using GetClearanceBetween Segments( ) function.

Jean-Pierre: During my "analysis" of the code, I encountered a function called
checkLine(), which tests a line against some rectangle which is stored in
DRC::m_xcliplo etc.
I think this function is really unintuitive (to be polite) as it uses some class members to do the test. Would you object if I removed that code and used
something cleaner (as the functions I mentioned above)? Or is there any
specific reason to do it with checkLine()?

- Jonas

__._,
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 be polite).
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 class.
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.

--
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 :
Grenoble Image Parole Signal Automatique (GIPSA - INPG)
Grenoble France






References