Page MenuHomePhabricator

PlanarFigureInteractor does not calculate distance of control-points correctly
Closed, ResolvedPublic

Description

The PlanarFigureInteractor has a method IsMousePositionAcceptableAsNewControlPoint() that it uses internally to check if the current mouse-cursor is far enogh from the existing control-points to create a new control-point. To achieve this, it calculates the distance of the cursor-position in display-coordinates to all control-points in display-coordinates.

This works fine in most cases. However, mitk::PlanarFigure has a method ApplyControlPointConstraints() that enforces a set of hard constraints that have to be met. The most basic one is that the control-points may not lie outside of the geometry.

If you have an empty planarFigure and Interactor is active and you double-click next to the actual mitkImage that is displayed, you will create invalid PlanarFigures:

  • First click places the PlanarFigure and set the current render-geometry as planarFiguregeometry. As the cursor position in display-coordinates is not inside this geometry (we clicked next to the image) the coordinates are corrected to lie inside the planarFiguregeometry.
  • The second click tries to add the second control-point and checks if the current cursor-position is valid. Thus the cursor-position is transformed to Display-coordinates and compared to all control-points in display-coordinates.

However, the cursor-position has not been corrected by the plnarfigure constraints yet. So the cursor-position does not equal the position of the resulting control-point.

The fix of the problem would be to apply the planarFigure constraints to the cursor-position in order to get the coordinates that would really be used by the resulting control-point.

Event Timeline

New remote branch pushed: bug-13756-control-point-distance-corrected

[398133]: Merge branch 'bug-13756-control-point-distance-corrected'

Merged commits:

2012-11-27 09:52:10 Markus Engel [3474dd]
corrected calculation of control-point distances


2012-11-27 09:51:39 Markus Engel [ec5e68]
made method ApplyControlPointConstraints() public

Markus, is this bug fixed? Can we close it?

Yes, it's basically fixed and integrated into master.
However, I wanted Daniel to take a look at it before closing the bug.

But I guess he can reopen the ticket if need be...

(In reply to comment #4)

Yes, it's basically fixed and integrated into master.
However, I wanted Daniel to take a look at it before closing the bug.

Looks good, you fixed an error in this control point placement logic