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.