From: Nathan H. <nj...@nj...> - 2014-03-23 17:02:29
|
I agree, I've always disliked H/VLine, but on the other hand, it is very important that we can directly represent all svg paths. This was actually one of the motivators for 2geom in the first place. Is there another way which would allow affine transforms to fail gracefully if one of the curves in a path were not transformable? This is a place where I would use exceptions in python, but C++ exceptions are somewhat unpopular IIRC. njh On Sun, Mar 23, 2014 at 03:07:52PM +0100, Johan Engelen wrote: > Hi all, > I finally came around to finishing this (initial) work, and have > committed it to trunk. > After Inkscape's release, we really have to look much further into > this. I think it is a huge burden and slowdown to not have Curves be > closed under arbitrary Affine. > As Krzysztof mentioned, it is probably not worth keeping HLineSeg > and VLineSeg because of this. > > regards, > Johan > > On 13-11-2013 17:44, Johan Engelen wrote: > >On 13-11-2013 16:50, Krzysztof Kosi??ski wrote: > >>2013/11/12 Johan Engelen <jbc...@sw...>: > >>>As far as I can see now, all (current) Curve types *are* closed under > >>>translations. I think we should enforce this for Curve. I.e., > >>>each Curve > >>>must implement > >>> virtual Curve &operator+=(Point const &); > >>I think the method should be: > >>virtual Curve &operator*=(Translate const &t) { > >> *this *= Affine(t); > >> return *this; > >>} > >> > >>Rationale: > >>1. It's not immediately obvious what adding a point to a curve means. > >>For instance, for BezierCurve it might plausibly mean adding a control > >>point. > > > >Ok, that makes sense. > > > >>2. For curves that don't implement the specialization, we just > >>multiply by a generic affine. > > > >This is not possible. Because curves are not closed under Affine > >transform, there is no operator*=(Affine). If you want to > >transform a Curve, you have to call > > Curve* Curve::transformed(Affine const&) > > > >I'll clean up the work and commit my changes, so you can see. > > > >Cheers, > > Johan > > > > > > ------------------------------------------------------------------------------ > Learn Graph Databases - Download FREE O'Reilly Book > "Graph Databases" is the definitive new guide to graph databases and their > applications. Written by three acclaimed leaders in the field, > this first edition is now available. Download your free book today! > http://p.sf.net/sfu/13534_NeoTech > _______________________________________________ > Lib2geom-devel mailing list > Lib...@li... > https://lists.sourceforge.net/lists/listinfo/lib2geom-devel |