Roassal3 icon indicating copy to clipboard operation
Roassal3 copied to clipboard

Imprecise mouse event recognition of RSBezier

Open JanBliznicenko opened this issue 1 year ago • 1 comments

I would like to use RSBezier instead of RSPolyline in OpenPonk for state machines and other kinds of diagrams that would look better with beziers.

In OpenPonk, it is important for user to "select" the line with mouse click (user does that a lot), but it does not work very well with RSBezier as the includesPoint approximation using lines is very imprecise (for my use case).

For beziers with 4 control points, increasing number of these lines help, but with only 3 control points, those lines are completely off.

Is there any possibility for improvement without having drastic effect on performance for larger drawings?

example

c := RSCanvas new.
bezier := RSBezier new.
bezier 
	width: 2;
	color: Color black;
	controlPoints: {-200@(-200). 0@400. 200@(-200)}.
	
bezier @ RSHighlightable red.

c add: bezier.

bezier lines overlappingPairsDo: [:from :to| c add: (RSLine new color: Color veryVeryLightGray; from: from; to: to; yourself)].

c open.

JanBliznicenko avatar Feb 26 '23 17:02 JanBliznicenko