[cairo] Obtaining two parallel paths from a single curve

archee@126 archee at 126.com
Tue Jul 29 07:14:58 PDT 2008



> archee at 126 (archee at 126.com) wrote:
>> Yes, it does work for a simple road. But what if you want to draw two 
>> directions of a road? In that case, each direction is actually an independent 
>> road but with the same shape.
> 
> *If* the two directions are always parallel you could draw a wide line
> (maybe also using two strokes for an outline) plus a very thin line
> indicating the separation between the two directions.
> 
> If this does not fit your problem: Unfortunately it is mathematically
> impossible to represent the parallel to a given bezier segment as a
> bezier segment, you have to resort back to approximations. There are
> solutions for this, you might find example code in inkscape. 
> 
> Bye,
>        Simon

In this way, you can not draw each direction of the road in different colors 
(for example, to present traffic condition on each direction). So I think, to draw
these parallel curves, I need to do some mathematical calculation to get two different
curves according to the following knowledge:

http://xahlee.org/SpecialPlaneCurves_dir/Parallel_dir/parallel.html
and
http://en.wikipedia.org/wiki/Parallel_curve


More information about the cairo mailing list