← Back to team overview

kicad-developers team mailing list archive

Re: [PATCH] Fix LIB_TEXT and LIB_FIELD bounding boxes

 

Le 17/06/2015 19:35, Chris Pavlina a écrit :
> You probably saw my thread about the bounding boxes for LIB_TEXT and 
> LIB_FIELD, which were being merged with the main component bounding box 
> incorrectly. I tracked down what the bug was:
> 
> in ::GetBoundingBox(), the coordinates are inverted because "Y 
> coordinates for LIB_ITEMs are bottom to top". Problem is, the bounding 
> boxes aren't used that way, they're expected in most places to be 
> noninverted. The only place the LIB_TEXT bounding box should be inverted 
> is in ::drawGraphics.
> 
> This patch moves the inversion to ::drawGraphics, fixing the bounding 
> box bug. The overall bounding box is now calculated correctly:
> 
> http://misc.c4757p.com/correct_bbox.png
> 
> Compare to the original version, where the text object that I moved 
> upwards caused the box to extend downwards:
> 
> http://misc.c4757p.com/bbox_wtf.png
> 
> This patch also corrects one other minor bug: the bounding box was 
> always calculated to include (0,0), even if the component itself doesn't 
> include this point.
> 
> --
> Chris


Thanks, Chris.

I'll have a look at these issues, because during investigations, I found
some other strange things.

You are right about incorrect Bounding box calculations:
Some use a bottom to top Y axis, some other a top to bottom Y axis.
This is the explanation of this issue.


-- 
Jean-Pierre CHARRAS


Follow ups

References