W3C home > Mailing lists > Public > whatwg@whatwg.org > September 2012

Re: [whatwg] Rename the 7-arg arcTo() to ellipseTo()?

From: Ian Hickson <ian@hixie.ch>
Date: Mon, 24 Sep 2012 20:14:38 +0000 (UTC)
To: "Tab Atkins Jr." <jackalmage@gmail.com>
Message-ID: <Pine.LNX.4.64.1209241955590.1904@ps20323.dreamhostps.com>
Cc: WHATWG List <whatwg@whatwg.org>
On Mon, 24 Sep 2012, Tab Atkins Jr. wrote:
> >
> > Omitting two numbers, one of which is zero, is easily no more a win 
> > than the cost of having two different nearly-identical commands. Just 
> > consider C/c and S/s; is it really worth it?
> 
> Yes, it is.  ^_^ The authoring convenience of not having to repeat 
> things, or not having to read past useless things, is fairly 
> significant.

Do we have any data on this? If this really is a concern, it may suggest 
that maybe the whole path syntax should be rethought. As it stands it 
already has quite a lot of repetition. For example, look at the amount of 
repetition in the examples for A/a in the SVG spec.


> > What's wrong with A/a? It seems to be equivalent to arcTo(). Is it 
> > arc() that you want to add? I'm very confused.
> 
> Oh, no, they're *completely* different.  arcTo() is *great*, because 
> it's convenient and solves a useful problem (rounding a corner) without 
> you having to do much math.  For A, you have to determine the start/end 
> points on the circle yourself, usually involving trig.  The only 
> similarity between the two commands is that they both draw an arc as 
> part of their operation.

I don't really follow.

The main use case for arcTo() is rounded corners. With A/a, these are 
trivial. Consider a 300x150 rectangle with 10px radius corners, top left 
corner at 0,0. There's no trig necessary, you just give the points on each 
side, with the radius as offset:

   d="M10,0 H290 A10,10 0 0 1 300,10
            V140 A10,10 0 0 1 290,150
            H10  A10,10 0 0 1   0,140
            V10  A10,10 0 0 1  10,0   
      Z"

(The Z isn't really necessary.)

If anything, I'd say this is better than what you have to do with 
arcTo(), since with that one you have to give both the corner coordinate 
and the destination coordinate, rather than just the latter.

Could you elaborate on what exactly it is that is being done here? If 
there were some examples showing the problems that would really help.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'
Received on Monday, 24 September 2012 20:16:32 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:45 UTC