W3C home > Mailing lists > Public > public-canvas-api@w3.org > July to September 2011

Re: elliptical canvas.arc?

From: Ian Hickson <ian@hixie.ch>
Date: Tue, 12 Jul 2011 15:24:40 +0000 (UTC)
To: Mike Kamermans <pomax@nihongoresources.com>
cc: public-canvas-api@w3.org
Message-ID: <Pine.LNX.4.64.1107121518070.3775@ps20323.dreamhostps.com>
On Tue, 10 May 2011, Mike \"Pomax\" Kamermans wrote:
> On 5/10/2011 8:30 PM, Ian Hickson wrote:
> > What is the use case for a dedicated ellipse API rather than using bezier?
> A fair question, with a pretty simple two-fold answer: 1) bezier arc 
> approximation is an approximation, using very expensive operations to 
> approximate a very cheap operation instead (and if you want to do it 
> right, there's first the particularly nasty business of working out the 
> math that tells you how many bezier segments you even need to get an 
> approximation with an precision-error lower than ...). That doesn't make 
> a lot of sense. 2) why would people have to reinvent the wheel time and 
> time again just to get an ellipse or elliptical arc? That's just bad API 
> design =)

Everything is an approximation on a pixelated plane, and no API is 
complete so there'll always be something for which an author has to 
reinvent the wheel. Those don't seem particularly compelling reasons.

> If that question underlines why there is no elliptical arc, then I could 
> of course retort with "good point: why is there a circular arc? you can 
> approximate it with bezier curves too." -- however the math for circular 
> arc approximation is just as hard as the math for elliptical arc 
> approximation. And it'll always be much more expensive to perform than 
> dedicated, actually correct, elliptical/circular arc functions.

The reason there's a circular arc is that that's what Apple implemented in 
their first version, and the spec was simply a description of what they did.

> I actually looked up how to get a message to this list, because I hear 
> everyone around me complain that there's no ellipse command, and that 
> the Canvas API people should do something about it. When asked if 
> they've posted to your list, the responses are invariably "no, I'm not 
> subscribed" or "they won't listen anyway". So I hope to prove the latter 
> wrong by arguing the case for an elliptical arc command. It just makes 
> sense to have one.

Given how trivial it is to post feedback using the form in the spec 
(either the form on the W3C spec or the even more convenient form on the 
WHATWG spec), I think we would have heard more requests if this was really 
something people asked for a lot. (For example, we've had plenty of 
requests for people wanting to know the bounding-box height of text!)

Anyway, I've not added an elliptical arc feature for now, but I agree that 
it would make sense to add it at some point, in due course.

Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'
Received on Tuesday, 12 July 2011 15:25:11 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 19:10:32 UTC