Currently most (all?) of the HitTest code uses intersection tests defined for EDA_RECT (which is already a large duplication of code). Should I refactor all of the ones I have touched to use the common/geometry routines?
On Fri, May 5, 2017 at 2:33 PM, Oliver Walters < [email protected]> wrote: > Tomasz, > > I would be happy to put my new code in a more generic location. I was not > aware of common/geometry and simply fixed the ::HitTest() functions that > were already present for each shape. > > I am a little confused by the numerous duplication of the "Rectangle" > class (SHAPE_RECT, EDA_RECT, BOX_2I, etc). > > My guess as to how I should implement each HitTest is: > > a) Construct a SHAPE_RECT from the EDA_RECT > b) Write generic SHAPE_RECT comparison classes for each other shape (arc, > circle, etc) where they do not already exist > c) Code each HitTest() function as a comindation of SHAPE_RECT tests as > defined in common/geometry? > > Regards, > Oliver > > On Fri, May 5, 2017 at 7:42 AM, Tomasz Wlostowski < > [email protected]> wrote: > >> On 02.05.2017 09:25, Oliver Walters wrote: >> > I have attached a patch-set that implements "partial selection" of >> > objects when the selection box is dragged right-to-left. >> > >> > L -> R = Objects must be completely enclosed to be selected >> > R -> L = Objects that intersect the selection rectangle will be >> selected. >> > >> >> Hi Olivier, >> >> I tested your patch and I like the way it works. As somebody suggested, >> changing the color of the selection area depending on the selection mode >> would make it easier to discover the new selection mode. >> >> > this was broken for most shapes, under a variety of edge cases (some >> > HitTest code did not work at all). >> > >> One remark about the HitTest() functions. We would prefer collision >> tests to be implemented in the geometry library (common/geometry) and so >> decoupled from the board objects to make these functions reusable. As a >> matter of a fact, the geometry library already does most collision >> checks between rectangles and other shapes (except for arcs and >> polysets). I noticed you're good with computational geometry, would you >> be able to move the features you wrote to the geometry library? >> >> Best, >> Tom >> >> > To achieve this I had to fix a lot of the HitTest implementations as >> > There are two issues I see as outstanding, and am unsure how to proceed: >> > >> > 1. When editing a PCB, selecting part of a footprint (e.g. a line of the >> > courtyard) selects both that line and the entire footprint. This causes >> > some issues when the footprint is dragged around the PCB. I believe that >> > the line should not be selected separately, but the entire footprint >> should. >> > >> > 2. The inverse of 1. In the footprint editor, selecting a single >> > graphical item selects the entire footprint. Somehow I would like to >> > filter the selection such that individual items are selected but NOT the >> > entire footprint. >> > >> > Feedback please! :) >> > >> > I have fixed hit testing (both for wxPoint and EDA_RECT comparison) for: >> > >> > - Pads (all shapes) >> > - Lines >> > - Circles >> > - Arcs >> > - Text items >> > - Zones >> > - Footprints >> > >> > Cheers, >> > Oliver >> > >> > >> > >> > >> > _______________________________________________ >> > Mailing list: https://launchpad.net/~kicad-developers >> > Post to : [email protected] >> > Unsubscribe : https://launchpad.net/~kicad-developers >> > More help : https://help.launchpad.net/ListHelp >> > >> >> >
_______________________________________________ Mailing list: https://launchpad.net/~kicad-developers Post to : [email protected] Unsubscribe : https://launchpad.net/~kicad-developers More help : https://help.launchpad.net/ListHelp

