new SVGEllipticalArc implementation merged into path.h
I merged my implementation of the SVGEllipticalArc class into path.h substituting the old one. Some method lacks of a native implementation, yet and it relies on a conversion to SBasisCurve, but the class is fully working (there isn't any not_implemented exception thrown any more). Moreover I commit a new version of the svg-elliptic-arc-toy, with the ability of testing the portion method too.
PAY ATTENTION ! I want to point out that I modified the src/CMakeList.txt file, adding some line of code in order to find out which version of ragel is installed. This is needed because starting from version 5.18 the ragel package substituted the command rlcodegen with the rlgen-cd command as specific code generator back-end for C, C++ and D languages. If you'll get into troubles when you build the library you'd look that you have the ragel package installed. Anyway in case of problem you can send me a mail or contact me on the lib2geom channel.
Regards, Marco
Good work, Marco! Has this been committed to both 2geom and inkscape?
-mental
On Fri, 11 Apr 2008 20:34:30 +0200, MenTaLguY <mental@...3...> wrote:
Good work, Marco! Has this been committed to both 2geom and inkscape?
-mental
Thanks :-) No I committed it only to lib2geom, but I can commit to inkscape too if this is desired.
Marco
On Fri, 11 Apr 2008 22:36:21 +0200, Marco <mrcekets@...400...> wrote:
Thanks :-) No I committed it only to lib2geom, but I can commit to inkscape too if this is desired.
Yes, please proceed.
-mental
Hi Marco,
I just committed it to Inkscape trunk (did a 2geom re-sync).
I think right now I can remove an error message in Inkscape=>2geom conversion when a path contains an 'A' description. Can't remember exactly, but will check soon. Thanks!!!
Johan
-----Original Message----- From: inkscape-devel-bounces@lists.sourceforge.net [mailto:inkscape-devel-bounces@lists.sourceforge.net] On Behalf Of MenTaLguY Sent: vrijdag 11 april 2008 23:20 To: Marco Cc: inkscape-devel@lists.sourceforge.net Subject: Re: [Inkscape-devel] [Lib2geom-devel] newSVGEllipticalArcimplementation merged intopath.h
On Fri, 11 Apr 2008 22:36:21 +0200, Marco <mrcekets@...400...> wrote:
Thanks :-) No I committed it only to lib2geom, but I can commit to
inkscape too
if this is desired.
Yes, please proceed.
-mental
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java
.sun.com/javaone
Inkscape-devel mailing list Inkscape-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/inkscape-devel
On Sun, Apr 13, 2008 at 4:29 PM, <J.B.C.Engelen@...1578...> wrote:
I think right now I can remove an error message in Inkscape=>2geom conversion when a path contains an 'A' description. Can't remember exactly, but will check soon. Thanks!!!
Before, pattern on path failed for ellipse pattern - now it crashes with:
inkscape: 2geom/svg-elliptical-arc.cpp:128: void Geom::SVGEllipticalArc::calculate_center_and_extreme_angles(): Assertion `-1 < arg && arg < 1' failed.
Emergency save activated!
On Mon, 28 Apr 2008 03:45:36 +0200, bulia byak <buliabyak@...400...> wrote:
On Sun, Apr 13, 2008 at 4:29 PM, <J.B.C.Engelen@...1578...> wrote:
I think right now I can remove an error message in Inkscape=>2geom conversion when a path contains an 'A' description. Can't remember exactly, but will check soon. Thanks!!!
Before, pattern on path failed for ellipse pattern - now it crashes with:
inkscape: 2geom/svg-elliptical-arc.cpp:128: void Geom::SVGEllipticalArc::calculate_center_and_extreme_angles(): Assertion `-1 < arg && arg < 1' failed.
Emergency save activated!
This assertion is raised when the parameter passed to the SVGEllipticalArc constructor can't be used to create an elliptical arc. That is, given the x and y rays, the rotation angle and the initial and final points there is no ellipse that satisfies all together such constraints and so it's not possible to build an elliptical arc with the passed data. Would you like to manage such case by throwing an exception or by quietly setting a boolean flag that will have to be tested after each elliptical arc instantiation ?
Marco
-----Original Message----- From: Marco [mailto:mrcekets@...400...] Sent: maandag 28 april 2008 12:07 To: bulia byak; Engelen, J.B.C. (Johan); MenTaLguY Cc: inkscape-devel@lists.sourceforge.net; lib2geom-devel@lists.sourceforge.net Subject: Re: [Inkscape-devel] [Lib2geom-devel] newSVGEllipticalArcimplementation merged intopath.h
On Mon, 28 Apr 2008 03:45:36 +0200, bulia byak <buliabyak@...400...> wrote:
On Sun, Apr 13, 2008 at 4:29 PM,
<J.B.C.Engelen@...1578...> wrote:
I think right now I can remove an error message in
Inkscape=>2geom
conversion when a path contains an 'A' description. Can't remember exactly, but will check soon. Thanks!!!
Before, pattern on path failed for ellipse pattern - now it
crashes with:
inkscape: 2geom/svg-elliptical-arc.cpp:128: void Geom::SVGEllipticalArc::calculate_center_and_extreme_angles(): Assertion `-1 < arg && arg < 1' failed.
Emergency save activated!
This assertion is raised when the parameter passed to the SVGEllipticalArc constructor can't be used to create an elliptical arc. That is, given the x and y rays, the rotation angle and the initial and final points there is no ellipse that satisfies all together such constraints and so it's not possible to build an elliptical arc with the passed data. Would you like to manage such case by throwing an exception or by quietly setting a boolean flag that will have to be tested after each elliptical arc instantiation ?
I think it's best when you change the assertion to throwing an exception (see exception.h for some macros). However, I think it is best if we add some sort of debug flag so that people can choose between throwing an exception or doing an assert (crash). Inkscape release should have exceptions, Inkscape devel should have crashes. That way we won't stop thinking about fixing the bugs, and also have a more stable release version. I'll have a look and change the exception.h macros according to this, so please use them :)
Kind regards, Johan
On Mon, 28 Apr 2008 12:14:13 +0200, <J.B.C.Engelen@...1578...> wrote:
-----Original Message----- From: Marco [mailto:mrcekets@...400...] Sent: maandag 28 april 2008 12:07 To: bulia byak; Engelen, J.B.C. (Johan); MenTaLguY Cc: inkscape-devel@lists.sourceforge.net; lib2geom-devel@lists.sourceforge.net Subject: Re: [Inkscape-devel] [Lib2geom-devel] newSVGEllipticalArcimplementation merged intopath.h
On Mon, 28 Apr 2008 03:45:36 +0200, bulia byak <buliabyak@...400...> wrote:
On Sun, Apr 13, 2008 at 4:29 PM,
<J.B.C.Engelen@...1578...> wrote:
I think right now I can remove an error message in
Inkscape=>2geom
conversion when a path contains an 'A' description. Can't remember exactly, but will check soon. Thanks!!!
Before, pattern on path failed for ellipse pattern - now it
crashes with:
inkscape: 2geom/svg-elliptical-arc.cpp:128: void Geom::SVGEllipticalArc::calculate_center_and_extreme_angles(): Assertion `-1 < arg && arg < 1' failed.
Emergency save activated!
This assertion is raised when the parameter passed to the SVGEllipticalArc constructor can't be used to create an elliptical arc. That is, given the x and y rays, the rotation angle and the initial and final points there is no ellipse that satisfies all together such constraints and so it's not possible to build an elliptical arc with the passed data. Would you like to manage such case by throwing an exception or by quietly setting a boolean flag that will have to be tested after each elliptical arc instantiation ?
I think it's best when you change the assertion to throwing an exception (see exception.h for some macros).
I see, I'll use the RangeError.
However, I think it is best if we add some sort of debug flag so that people can choose between throwing an exception or doing an assert (crash).
Do you mean a simple #ifdef DEBUG or an ad-hoc flag ? Something like ELLIPTICAL_ARC_DEBUG ?
Inkscape release should have exceptions, Inkscape devel should have crashes. That way we won't stop thinking about fixing the bugs, and also have a more stable release version. I'll have a look and change the exception.h macros according to this, so please use them :)
That's ok.
Marco
However, I think it is best if we add some sort of debug
flag so that
people can choose between throwing an exception or doing an assert (crash).
Do you mean a simple #ifdef DEBUG or an ad-hoc flag ? Something like ELLIPTICAL_ARC_DEBUG ?
I meant a global flag, that chooses how to expand the exception throw macros; not just for the elliptical arc implementation. So 2geom either throws exceptions or does asserts.
#define LIB2GEOM_EXCEPTIONS // define to have 2geom throw exceptions instead of asserts
On Mon, 28 Apr 2008 13:16:19 +0200, <J.B.C.Engelen@...1578...> wrote:
However, I think it is best if we add some sort of debug
flag so that
people can choose between throwing an exception or doing an assert (crash).
Do you mean a simple #ifdef DEBUG or an ad-hoc flag ? Something like ELLIPTICAL_ARC_DEBUG ?
I meant a global flag, that chooses how to expand the exception throw macros; not just for the elliptical arc implementation. So 2geom either throws exceptions or does asserts.
#define LIB2GEOM_EXCEPTIONS // define to have 2geom throw exceptions instead of asserts
That's ok, however I was thinking that it would be better to have the conditional defined code in just one place. So what do you think of defining the throwXxxxYyyy macros in the following way:
#ifdef LIB2GEOM_EXCEPTIONS # define throwException( cond, message ) \ if ( (cond) ) throw(Geom::Exception(message, __FILE__, __LINE__)) # define throwRangeError( cond, message ) \ if ( (cond) ) throw(RangeError(message, __FILE__, __LINE__)) . . . #else # define throwException( cond, message ) \ if( (cond) ) std::cerr << "lib2geom Error: " << message << std::endl; \ assert( (cond) ) # define throwRangeError( cond, message ) \ if( (cond) ) std::cerr << "lib2geom RangeError: " << message << std::endl; \ assert( (cond) ) . . . #endif // LIB2GEOM_EXCEPTIONS
Marco
On Mon, 28 Apr 2008 14:07:46 +0200, Marco <mrcekets@...400...> wrote:
#ifdef LIB2GEOM_EXCEPTIONS # define throwException( cond, message ) \ if ( (cond) ) throw(Geom::Exception(message, __FILE__, __LINE__)) # define throwRangeError( cond, message ) \ if ( (cond) ) throw(RangeError(message, __FILE__, __LINE__)) . . . #else # define throwException( cond, message ) \ if( (cond) ) std::cerr << "lib2geom Error: " << message << std::endl; \ assert( (cond) ) # define throwRangeError( cond, message ) \ if( (cond) ) std::cerr << "lib2geom RangeError: " << message << std::endl; \ assert( (cond) ) . . . #endif // LIB2GEOM_EXCEPTIONS
Marco
Ops, I forgot some logical negation :
#ifdef LIB2GEOM_EXCEPTIONS # define throwException( cond, message ) \ if ( (cond) ) throw(Geom::Exception(message, __FILE__, __LINE__)) # define throwRangeError( cond, message ) \ if ( (cond) ) throw(RangeError(message, __FILE__, __LINE__)) . . . #else # define throwException( cond, message ) \ if( (cond) ) std::cerr << "lib2geom Error: " << message << std::endl; \ assert( !(cond) ) # define throwRangeError( cond, message ) \ if( (cond) ) std::cerr << "lib2geom RangeError: " << message << std::endl; \ assert( !(cond) ) . . . #endif // LIB2GEOM_EXCEPTIONS
-----Original Message----- From: Marco [mailto:mrcekets@...400...] Sent: maandag 28 april 2008 14:08 To: Engelen, J.B.C. (Johan); buliabyak@...400...; mental@...3... Cc: inkscape-devel@lists.sourceforge.net; lib2geom-devel@lists.sourceforge.net Subject: Re: [Inkscape-devel] [Lib2geom-devel] newSVGEllipticalArcimplementation merged intopath.h
On Mon, 28 Apr 2008 13:16:19 +0200, <J.B.C.Engelen@...1578...> wrote:
However, I think it is best if we add some sort of debug
flag so that
people can choose between throwing an exception or doing
an assert
(crash).
Do you mean a simple #ifdef DEBUG or an ad-hoc flag ? Something like ELLIPTICAL_ARC_DEBUG ?
I meant a global flag, that chooses how to expand the
exception throw
macros; not just for the elliptical arc implementation. So
2geom either
throws exceptions or does asserts.
#define LIB2GEOM_EXCEPTIONS // define to have 2geom throw
exceptions
instead of asserts
That's ok, however I was thinking that it would be better to have the conditional defined code in just one place. So what do you think of defining the throwXxxxYyyy macros in the following way:
Exactly what I meant :-)
On Mon, 28 Apr 2008 15:04:44 +0200, <J.B.C.Engelen@...1578...> wrote:
-----Original Message----- From: Marco [mailto:mrcekets@...400...] Sent: maandag 28 april 2008 14:08 To: Engelen, J.B.C. (Johan); buliabyak@...400...; mental@...3... Cc: inkscape-devel@lists.sourceforge.net; lib2geom-devel@lists.sourceforge.net Subject: Re: [Inkscape-devel] [Lib2geom-devel] newSVGEllipticalArcimplementation merged intopath.h
On Mon, 28 Apr 2008 13:16:19 +0200, <J.B.C.Engelen@...1578...> wrote:
However, I think it is best if we add some sort of debug
flag so that
people can choose between throwing an exception or doing
an assert
(crash).
Do you mean a simple #ifdef DEBUG or an ad-hoc flag ? Something like ELLIPTICAL_ARC_DEBUG ?
I meant a global flag, that chooses how to expand the
exception throw
macros; not just for the elliptical arc implementation. So
2geom either
throws exceptions or does asserts.
#define LIB2GEOM_EXCEPTIONS // define to have 2geom throw
exceptions
instead of asserts
That's ok, however I was thinking that it would be better to have the conditional defined code in just one place. So what do you think of defining the throwXxxxYyyy macros in the following way:
Exactly what I meant :-)
Ah ok. Sorry, I incurred in an "english" misunderstanding.
Btw, what should I do to get an inkscape svn account (write-enabled) so I can commit the modified files directly ?
Marco
I turned assertions into calls to the throwRangeError macro. I committed the changes to both lib2geom and inkscape.
Regards, Marco
participants (4)
-
unknown@example.com
-
bulia byak
-
Marco
-
MenTaLguY