pharo-graphics / Roassal

The Roassal Visualization Engine
MIT License
14 stars 8 forks source link

Imprecise mouse event recognition of RSBezier #40

Closed akevalion closed 6 months ago

akevalion commented 7 months ago

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.
akevalion commented 6 months ago

Moved to roassal3