Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature to add curve with custom radius to the arrow tip #119

Merged
merged 1 commit into from
Sep 22, 2024

Conversation

ak424
Copy link

@ak424 ak424 commented Sep 3, 2024

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

Screenshot 2024-09-03 at 4 45 30 PM

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.

@bensonarafat
Copy link
Owner

thanks @ak424
I will review this.
thanks for your contribution

@ak424
Copy link
Author

ak424 commented Sep 19, 2024

Hi @bensonarafat, just a friendly reminder to review the PR when you have a moment. Thanks!

@bensonarafat bensonarafat merged commit 7bd0543 into bensonarafat:master Sep 22, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants