← Back to team overview

kicad-developers team mailing list archive

Re: Geometry ongoing work

 

Le 26/07/2016 à 15:57, Wayne Stambaugh a écrit :
> On 7/26/2016 9:29 AM, Nick Østergaard wrote:
>> 2016-07-26 14:58 GMT+02:00 Wayne Stambaugh <stambaughw@xxxxxxxxx>:
>>> On 7/26/2016 7:20 AM, Nick Østergaard wrote:
>>>> Welcome.
>>>>
>>>> I have found a pcb file on my computer, I am not sure of its origin,
>>>> that has a buggy rendering both in legacy and GAL in different, but
>>>> similar ways. Maybe you should include this in your testing and
>>>> development.
>>>>
>>>> About unittests, there is already some stuff in the qa folder using
>>>> python... but this is mostly a proof of concept. Nothing is really
>>>> tested at the moment, except for file loading more or less. I would
>>>> personally like to see some more testing, although I am not sure that
>>>> the boost test module is the best for this either.
>>>
>>> I suggested using the boost unit testing framework to Alejandro.  The
>>> problem with using python unit testing is that not everything in Pcbnew
>>> is swigged so you wouldn't be able to test that code unless there is
>>> someway to compile and run C++ test code from the python unit test
>>> framework.  If this can be done, then boost unit test wouldn't be necessary.
>>>
>>> While I'm not 100% convinced that the boost unit test frameworks is the
>>> way to go, it seems to compare well to the other C++ test frameworks.
>>> The benefit is it does not add yet another dependency and allows us to
>>> use C++ code to write tests.  I do not have any experience in this area
>>> so if someone as experience using the different c++ unit test
>>> frameworks, feel free to comment.
>>>
>>>>
>>>> Will your work eventually lead to use for example arcs on copper
>>>> layers, which is not supported by the DRC?
>>>
>>> It should allow for this but AFAIK we still cannot generate gerbers with
>>> arcs.
>>
>> Why not?
> 
> Don't know.  Maybe because we don't have DRC support for arcs yet.  All
> arcs and circles (except pads) on copper layers are generated as a
> series of line segments rather than arcs.  Someone please correct me if
> I am wrong about this.

The problems I see with arcs on copper are:
* DRC between arcs and segments, without increase the calculation time (not yet supported)
* polygons (zone outlines and filled areas) mixing arc and segments are not easy to handle, for DRC,
filling and drawing filled areas.
* creating tracks connected by arcs is easy, but editing them (dragging for instance) is tricky.

The cost to support arcs in copper layers (tracks and polygons) is high, and the benefit is low.


> 
>>
>> The gerber spec has: 4.5  Circular Interpolation (G02/G03) and (G74/G75)
>>
>> I might be misinterpreting the spec, but I see that as it supports
>> _circular_ arcs. Which is what we have in KiCad.
>>
>>>
>>>>
>>>> Nick
>>>>
>>>> 2016-07-15 12:25 GMT+02:00 Alejandro Garcia Montoro
>>>> <alejandro.garciamontoro@xxxxxxxxx>:
>>>>> Hi!
>>>>>
>>>>> I've been working on some geometry code on this branch:
>>>>> https://code.launchpad.net/~alejandro-garciamontoro/kicad/kicad-polygon-refactor
>>>>>
>>>>> This is still an ongoing work. You can consider this as a new developer
>>>>> getting used to the code, waiting for Wayne and Javier to review the code
>>>>> and decide if I finally join the team :) By the way, for the guys that were
>>>>> not at the CERN hackaton: I am Alejandro García, a Computer Science and
>>>>> Mathematics student from Granada, Spain; the idea is to work on KiCAD
>>>>> full-time once I finish my studies; that is, since September 19th.
>>>>>
>>>>> So far, the following has been done:
>>>>>
>>>>> CPolyLine refactoring, thouroughly tested in the tests directory.
>>>>>
>>>>> CPolyLine::Chamfer method has been refactored into
>>>>> SHAPE_POLY_SET::ChamferPolygon method. The main behaviour of the old method
>>>>> has been maintained, returning a completely new POLYGON object; if you think
>>>>> it should modify the original polygon instead of returning a copy of a new
>>>>> one, let me know. This was done this way just to preserve the way CPolyLine
>>>>> did its job. Furthermore, a sanity check was introduced into the old
>>>>> CPolyLine method: due to rounding errors, two corners with the exact same
>>>>> coordinates could be added, and the CPolyLine::RemoveNullSegments was not
>>>>> able to remove them (this is a bug that should be studied if we continue to
>>>>> use CPolyLine code; as this is not the idea, I just fixed the errors in the
>>>>> new ChamferPolygon method to be able to test my refactoring).
>>>>> CPolyLine::Fillet method has been refactored into
>>>>> SHAPE_POLY_SET::FilletPolygon method. The same previous comments apply here.
>>>>> The AppendBezier methods have not been moved to SHAPE_POLY_SET yes. As I
>>>>> think Michele is working on a SHAPE_ARC class, I though it's better to wait
>>>>> for that code to be ready.
>>>>>
>>>>> The collision between a SHAPE_POLY_SET object and a point has been
>>>>> implemented and tested: the main behaviour is managed from the Contains
>>>>> method, that has been fixed to support holes, and that is implemented with
>>>>> the new containsSingle private method.
>>>>> Some more simple methods have been implemented in the SHAPE_POLY_SET class:
>>>>> HasHoles method, which was declared but not defined and PointOnEdge, which
>>>>> is basically a loop over the SHAPE_LINE_CHAIN::PointOnEdge method.
>>>>> A tests folder has been added to the project directory structure (the main
>>>>> CMakeFile.txt was also modified in order to handle this new directory).  As
>>>>> a new developer in the project I missed there were some kind of standard
>>>>> test suite in KiCAD to be used; hopefully, Michele showed to me at CERN how
>>>>> he was doing his tests (thank you!), so this is based on his files. I think
>>>>> we should make sure that in the not so distant future we add some standard
>>>>> test suite to the project; maybe not this one, as I think you wanna get rid
>>>>> of Boost library and these tests are based on Boost Test; anyway, I think
>>>>> this could be a good idea for the project.
>>>>> The tests folder I added contains the following new files:
>>>>>
>>>>> CMakeLists.txt: it creates a new MyTests executable inside the tests
>>>>> directory.
>>>>> module.cpp: Defines the Boost test module.
>>>>> fixtures.h: Defines common data for the tests to check the methods.
>>>>> chamfer_fillet_test.cpp: Defines unity tests to check the CPolyLine ->
>>>>> SHAPE_POLY_SET refactor did not change the previous behaviour.
>>>>> collision_test.cpp: Defines unity tests to check the implementation of the
>>>>> methods HasHoles, PointOnEdge, Contains and Collide works well.
>>>>>
>>>>> Wayne, please, review these code changes and let me know if there is
>>>>> anything wrong or something I can improve for the future work :)
>>>>>
>>>>> Looking forward to hear from you, guys!
>>>>>
>>>>> Regards,
>>>>> Alejandro



-- 
Jean-Pierre CHARRAS


References