← Back to team overview

kicad-developers team mailing list archive

Re: PCBNEW NANOMETRES build zoom crash

 

On 04/18/2012 03:23 PM, Dick Hollenbeck wrote:
> On 04/18/2012 02:48 PM, jean-pierre charras wrote:
>> Le 18/04/2012 20:25, Dick Hollenbeck a écrit :
>>>> I am working on this today.
>>>>
>>>> My gut says this:
>>>>
>>>>
>>>> Basically it comes down to the fact that we cannot describe an area larger than about 12
>>>> feet with the nanometer internal units.
>>> Jean-Pierre,
>>>
>>> Can you first look over the attached patch, then play with it.
>>>
>>> This basically fixes the crash, but I think there's more finishing touches that need to be
>>> done.
>>>
>>> I need to get back to work now.
>>>
>>>
>>> Thank you very much,
>>>
>>> Dick
>> I'll work on that tomorrow.
>>
>> I also make some tests.
>> Under Windows I did now have crashes, but I had other issues.
>>
>> my opinion is with 32 bits integers we cannot handle more than something like 50 to 70 cm,
>> with nanometers units.
>>
>> I noticed there are a lot of issues when calculating distance between 2 points.
>>
>> Assuming calculations are using integers, with 32 bits we can handle 2 meters distances only.
>> if Xmax and Ymax are Y and Y difference between 2 points,
>> only Y or Y max <= 1.4 meter, if sqrt( Xmax*Xmax + Ymax*Ymax) always < 2m.
>>
>> Because a distance is always >= 0, this means X and Y coordinates must have absolute coordinates < 70 cm.
>> With margins around work area, and because Pcbnew and Gerbview use a page only with positive coordinates,
>> the active area has a size < 50cm, roughly 20 inches, or A3 or B page size.


70 cm, this is only seven cigarettes in length.  What happened to twelve feet?


If we're going to let this go up in smoke, can we choose which kind of cigarettes?

If we "cry uncle", then at that point I'd choose skunk weed, and wonder what this is all
about.



But no, "Bob's your uncle", please take a look at my latest commit, which introduces this

KiROUND KIT, in common.h.  Move it where you want.  wxRound() is gone.


Also, look over my distance.patch from previous email, apply it is my suggestion.

Then when you get a return value from a function like Distance(), somewhere HIGHER up,
that needs to assign that double to an int, first challenge this notion, stay in double as
long as you can.  But where you must, use the KiROUND() kit.

In the end, see how "high up" you can push KiROUND() sites.   This will cause you to use
doubles as long as possible.  grep for them.

You also want to never assign from a double to int without using KiROUND kit, and again,
do it as seldom as possible, and as high up as possible.


Dick


(Jean-Pierre goes off to look up "cry uncle", and "Bob's your uncle", just to find out
what the hell Dick meant.)







References