Subject: Re: [office] How to calculate the start and end point of an elliptical arc from given angles.
Hi Thorsten, Thorsten Behrens schrieb:
Hi Regina, thanks for another detailed analysis here - you wrote:But the specification does not describe, how to calculate the start and end point. I have tested it with some applications and found, that actually two methods are used. (1) Used by LibreOffice 4.0 and PowerPoint 2013 Preview Draw an angle with the given value (here 30deg and 315deg). Calculate the intersection of the leg of the angle with the full ellipse (here center (3000|1000) and size (6000|2000)).That at least appears to be the simplest interpretation.
Method (2) is simple too. Only my description was complicated :( Here a hopeful simpler one: Use a unit circle and intersect it with the leg of the angle (that's simple cos and sin) and then use a transformation matrix to fit the unit circle into the target rectangle area (that's a simple scale and translate).
Method (2) is used for the primitive ellipse <draw:ellipse>. Also note
that those enhanced paths are more-or-less a bijection of those binary ppt autoshape things (see also 20.1.9 in ISO 29500), and keeping that mapping lossless and/or preventing excessive recalculation seems desirable.
As far as I know, neither the current import filter nor the predefined customshapes themselves in AOO use the commands U or T at all. The commands A,B,V,W are used, which do not define start and end by an angle but by points.
I have no proposal, because both methods are reasonable.I wonder how wide-spread those commands are - where did you notice the difference, I presume there is a bug report somewhere?
No bug report yet.There is no UI to define own custom shapes. But there might exist a shape collection, where the commands are used. I don't know, and considering millions of downloads, and the time, the custom shapes exist now, I will not estimate it.
I examined draw:enhanced-path, when I prepared my talk about custom shapes for FOSDEM, but skipped all problems at that time. It was only when I have the custom-shapes now examined more closely, I noticed that the command U is rendered different in LO and AOO.
Kind regards Regina