[cairo] Drawing an arrow

Andrea Canciani ranma42 at gmail.com
Wed Nov 24 01:58:22 PST 2010


On Wed, Nov 24, 2010 at 10:50 AM, donn <donn.ingle at gmail.com> wrote:
> On 23/11/2010 19:09, Stefan Salewski wrote:
>>
>> Can you imagine building an arrow of 3 or more line segments?
>
> The OP is a question I would like to see answered too. The problem is how to
> find the three points to define the arrow. If you have a bezier-curve, so
> the line is some S shape, how do you get the arrow to point along the
> direction that the curve sort of ends in?

For a bezier curve, the end direction is the same as the direction of the line
connecting last two non-coincident nodes:

Take the bezier a-b-c-d.

if c != d, end = c -> d
if c = d && b !=d, end = b -> d
if b = c = d && a !=d, end = a -> d
otherwise you have a single point (thus no direction).


More information about the cairo mailing list