Issue 121437 - Custom shape with quadratic Bezier curve (= command Q) does not show the curve
Summary: Custom shape with quadratic Bezier curve (= command Q) does not show the curve
Status: CLOSED FIXED
Alias: None
Product: Draw
Classification: Application
Component: code (show other issues)
Version: 4.0.0-dev
Hardware: PC Windows XP
: P3 Normal (vote)
Target Milestone: 4.0.0
Assignee: Regina Henschel
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-12-04 22:23 UTC by Regina Henschel
Modified: 2022-10-28 12:54 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments
quadric bezier curve and screenshot (18.68 KB, application/vnd.oasis.opendocument.graphics)
2012-12-04 22:23 UTC, Regina Henschel
no flags Details
Example with command Q as first command (10.62 KB, application/vnd.oasis.opendocument.graphics)
2012-12-07 16:00 UTC, Regina Henschel
no flags Details
proposed patch. I uses an equivalent cubic Bezier curve (2.60 KB, patch)
2012-12-07 16:05 UTC, Regina Henschel
rb.henschel: review?
Details | Diff

Note You need to log in before you can comment on or make changes to this issue.
Description Regina Henschel 2012-12-04 22:23:12 UTC
Created attachment 80000 [details]
quadric bezier curve and screenshot

The attached document contains a custom shape with a quadric Bezier curve, which is defined by the command Q. This curve is not drawn. Use the Navigator to see, where the object is located.
Right from the shape I have inserted a screenshot, how this shape looks in LibreOffice.
Comment 1 Regina Henschel 2012-12-05 21:40:32 UTC
Seams the case QUADRATICCURVE_TO is missing in EnhancedCustomShape2d::CreateSubPath(...) in /main/svx/source/customshapes/EnhancedCustomShape2d.cxx. Is that the only place, where I would need to add something?
Comment 2 Armin Le Grand 2012-12-06 13:30:17 UTC
ALG: Hi Regina,
had no time yet to take a deeper look, but that's the central place to add something, and AFAIK it should be the only one.

HTH!
Comment 3 Regina Henschel 2012-12-06 14:16:49 UTC
I'll try it.
Comment 4 Regina Henschel 2012-12-07 16:00:11 UTC
Created attachment 80008 [details]
Example with command Q as first command

The file contains a custom shape, which has a Q command as first command. Such file makes no sense, because the start point of the Bezier curve is missing. But such a path is syntactically correct and it should not crash the application.
Comment 5 Regina Henschel 2012-12-07 16:05:58 UTC
Created attachment 80009 [details]
proposed patch. I uses an equivalent cubic Bezier curve

@Armin: Please have a look. If you like it, can you please push it? I have not moved my build to the new location yet.
Comment 6 Ariel Constenla-Haile 2012-12-07 16:25:31 UTC
@Regina: how do you draw such custom shapes with commands? do you use a macro or is it possible in the user interface?
Comment 7 Regina Henschel 2012-12-07 16:37:35 UTC
@Ariel: I write it directly into the file. You find a starting description in http://books.evc-cit.info/odbook/custom_shapes_article.odt. I'm considering to make a talk for FOSDEM about that. And playing around for that, I have come across the problem with the command Q in AOO.
There is no UI for custom shapes. I have not tried macros yet.
Comment 8 Armin Le Grand 2012-12-07 17:59:30 UTC
ALG: @Regina: On Monday, I need my weekend :-) You are at Fosdem, Yay! Looking forward to meet...
Comment 9 Armin Le Grand 2012-12-10 14:47:49 UTC
ALG: @Regina: Looks good to me :-)
I would start changing GetPoint to return basegfx:B2DPoint, work on double precision and do the calculations with aControlQ in double, but that's too much before aw080 is in ....)
One question: I'm sure you have tested the functionality, but is it correct that aControlA *and* aControlB are both calculated with addition of the needed part of aControlQ, or should for ControlPointB (the one from endpoint) a substraction be used...?
Comment 10 Regina Henschel 2012-12-10 15:10:21 UTC
I have tested it and calculated on paper. You find the formula in http://de.wikipedia.org/wiki/B%C3%A9zierkurve#Kubische_Darstellung_quadratischer_B.C3.A9zierkurven.
I have only expanded "P0 + 2/3(P12 - PO)" to "1/3 P0 + 2/3 P12".
Comment 11 Armin Le Grand 2012-12-10 15:47:16 UTC
ALG: Okay, tanks, Regina. Comitted, done.
BTW: relocating a CWS unbder svn is quite simple: use 'svn switch https://svn.apache.org/repos/asf/openoffice/trunk/main'. It worked without problems here...
Comment 12 Armin Le Grand 2012-12-10 16:06:58 UTC
ALG: Commit has rev 1419533
Comment 13 SVN Robot 2012-12-10 16:08:16 UTC
"alg" committed SVN revision 1419533 into trunk:
#121437# Added patch from Regina which implements QuadraticBezier segemnts to...