Page MenuHomePhabricator

Interaction with SubdivisionPolygon does not work correctly
Closed, ResolvedPublic

Description

Due to changes made in T17739 it is no longer possible to insert additional control-points at a specific position in subdivision-polygons.

In the original code, the polyline of a PlanarFigure was represented by a struct of a Point2D and the index of the controlpoint after which this polylinepoint is loacted. In T17739 this struct was replaced by a simple Point2D, so the correspondance of polyline-points to control-points is missing.

Thus, the PlanarFigureInteractor searches for the index of the polyline-element on which the cursor is located (e.g. 83), and tries to add the new control-point at position 83 (which is the index of the polyline-element and not the index of the control-point). As the figures might only have e.g. 6 control-points, the new point is appended instead of being inserted at the correct position.

Thus, instead of adding a point between two existing control-points, that point is added as a new control-point between the last and the first control-points...

Event Timeline

I would strongly suggest a solution which doesn't add complexity to *all* kinds of planar figures as the old solution did. Instead we should prefer a you-get-what-you-pair-for approach, i.e., handle polyline point / control point associations separately off-side and only if necessary at all. A first idea could be a map from the polyline index to the corresponding control point index. A method like GetPreviousControlPoint(int polyLineIndex) could either just return the polyLineIndex itself in its simple path or, if activated, using a map to get the right index, whereas special planar figures are responsible to correctly feed the map.

I have implemented a new method GetControlPointForPolylinePoint() that does just that.

All I have to do now is move it to the classes where it's actually needed. Right now it's located in the PlanarFigure (baseclass).

User engelm has pushed new remote branch:

bug-18859-fix-interaction-with-interpolated-planarfigures

User engelm has pushed new remote branch:

bug-18859-fix-interaction-with-interpolated-planarfigures-rebased

[b94a3e]: Merge branch 'bug-18859-fix-interaction-with-interpolated-planarfigure

Merged commits:

2015-07-10 11:45:44 Markus Engel [c903ea]
removed unnecessary implementation of destructors


2015-07-10 11:45:13 Markus Engel [8bc86e]
using new method GetControlPointForPolylinePoint() in interactor


2015-07-10 11:44:15 Markus Engel [9af575]
added new method GetControlPointForPolylinePoint() to relevant classes

[27e73b]: COMP: Merge branch 'bug-18859-fix-interaction-with-interpolated-planar

Merged commits:

2015-07-10 13:05:40 Markus Engel [af534a]
fixed warnings treated as errors

Has been integrated into 2015.05.2

[5b92ef]: Merge branch 'bug-18859-fix-interaction-with-interpolated-planarfigure

Merged commits:

2015-08-12 16:10:44 Stefan Kislinskiy [754447]
Disallow adding new points to already placed Bezier curve.


2015-08-12 16:10:03 Stefan Kislinskiy [a96c27]
Handle all invalid polyline point indices in GetControlPointForPolylinePoint method.


2015-08-12 16:08:37 Stefan Kislinskiy [1bb8dc]
Added missing virtual keyword to GetControlPointForPolylinePoint method.