New arrows for ConnectorMorph

Andreas Raab andreas.raab at gmx.de
Thu Sep 7 06:30:38 UTC 2006


Noury Bouraqadi wrote:
> I'd like to have connectors with new arrow shapes (circles, arcs, 
> rhombus...)
> How can do that? Together with Serge, we had a look on class methods 
> such as NCAAConnectorMorph class>>#basicArrow (see code below).
> But, we could not figure-out how to easily and cleanly change the points 
> to have the expected shape.

This is a quadratic bezier curve. Each segment is made up by three 
consecutive points where the first and the third point are start and end 
and the intermediate is a control point that describes how the curve is 
shaped. To draw straight lines, have the intermediate point coincide 
with either start or end. See also (but for cubic beziers) the 
description at wikipedia:

   http://en.wikipedia.org/wiki/Bezier_curve

On a related note, be advised that non-rational bezier curves cannot 
truthfully approximate circles and other conic sections. To approximate 
ellipses see Bezier2Segment class>>makeEllipseSegments: in the 3.9 
graphics package. The points you see in Ned's spec are the control 
points of such segments (this may be helpful with exploring the exact 
shape you are trying to construct).

Hope this helps,
   - Andreas



More information about the Squeak-dev mailing list