Feature to add curve with custom radius to the arrow tip #119
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently, the arrow tip have a sharp point (V). This feature is added to give the functionality to give a curve at the tip with a custom radius which can be given explicitly
In all the directions, right now the arrow is formed by joining two straight lines. In this PR, i have added an arc between two straight lines to form a curve with a custom radius.
As shown in the diagram, i have taken an arc of a small circle with center (0,0), radius R and an angle of 90°. So, the points on the circle between arc is created will be (-R Sin 45°, R Cos 45°) and (R Sin 45°, R Cos 45°). And Cos45° and Sin 45° value is 1/√ 2.
So the exact point of the start of the curve would be (target.dx - R/√ 2 , target.dy + arrow_tip_length - (R - R/√ 2)). As the distance of the start position on y axis will be -> target.dy + arrow_tip_length - (R - R Cos45°) . Hence, i have created a straight line first upto this point , then added a curve to the point (target.dx + R/√ 2 , target.dy + arrow_tip_length - (R - R/√ 2)) with radius R. Then a straight line as before to the point on the rectangle. Similarly, I have added this in all the directions with proper points and angles.
Default value arrowTipRadius(R) is set to be 0 which will give a sharp tip as before since there will be no arc in that case. Then developer can give custom arrowTipRadius for the curve.