[kde-edu]: Kig exporters: fix for rational bezier curves

Raoul raoulb at bluewin.ch
Wed Mar 30 17:57:46 CEST 2011


In a recent mail I wrote:

> > And the rational bezier cuves do crash Kig when exporting
> > to PSTricks, pgf/Tikz and Asy. But we can export to images
> > and svg.

Today I debugged this and found what I think is the reason.
Although I'm no expert on such things it seems to me the cause
is an endless call loop in the following two code parts:


void RationalBezierImp::visit( ObjectImpVisitor* vtor ) const
  vtor->visit( this );

And object_imp.cc:83

void ObjectImpVisitor::visit( const ObjectImp* imp )
  imp->visit( this );

The generic visit( const ObjectImp* imp ) is called because we
have no specialization for RationalBezierImp Objects. I don't
know why the generic function should call again imp->visit( this ) ...?

If I add this specialized function the issue is fixed. The patch
attached does this and overwrites the function for Asy/TikZ and PS
exporters. Thus we can now export rational bezier curves :-)

However the issue of course remains for other object types
where there is no suitable visit function in the visitor.
(I did not check if there are any more issues.)

I included a second minor fix allowing the PSTricks exporter to
export bezier curves. At the moment it just exports the nodes.

All these implementations for rational bezier curves rely on the
plotGenericCurve function which sometimes does a questionable job.
As I noted in the comments we should improve this later. But I
have to look up how to compute rational bezier curves with the
given functionality of asy/pgf/PS.

I also attached several examples if you are interested.
Sorry for the big files.

-- Raoul
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rat_bezier_patch.diff
Type: text/x-patch
Size: 3718 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/kde-edu/attachments/20110330/71a87575/attachment-0001.diff 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bezier_fix_demos.tar.gz
Type: application/x-gzip
Size: 739872 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/kde-edu/attachments/20110330/71a87575/attachment-0001.gz 

More information about the kde-edu mailing list