Re: [whatwg] [Canvas] Behavior on non-invertable CTM

On Mar 17, 2014, at 3:49 PM, Justin Novosad <junov@google.com> wrote:

> On Fri, Mar 14, 2014 at 4:50 PM, Ian Hickson <ian@hixie.ch> wrote:
> 
>> On Fri, 7 Feb 2014, Justin Novosad wrote:
>>>>> 
>>>>> Current text: If the point (x0, y0) is equal to the point (x1, y1),
>>>>> or if the point (x1, y1) is equal to the point (x2, y2), or if both
>>>>> radiusX and radiusY are zero, then the method must add the point
>>>>> (x1, y1) to the subpath, and connect that point to the previous
>>>>> point (x0, y0) by a straight line.
>>> 
>>> With arcTo, the first point (x0, y0) may have been added to the current
>>> subpath using a different CTM. So to bring it into the local space of
>>> the current primitive, we need an invertible CTM.
>> 
>> What I don't understand is why you can't draw the curve in the transformed
>> space instead of the 1:1 coordinate space. You have to transform it
>> eventually, right? And the points will end up simply transformed. So you
>> can easily compare the points in the transformed space. All the transforms
>> are affine, so what's a straight line isn't impacted. Can't you just draw
>> the transformed arc instead of first drawing the circular arc and then
>> transforming it?
> 
> 
>> Maybe what I'm saying is obviously dumb for some reason, but I'm not
>> understanding why, if so... (not that I'm a graphics guy, obviously.
> 
> 
> Hmmm, I gave this a bit more thought...  To apply the construction
> algorithm in transformed space, the ellipse parameters (radiusX, radiusY,
> rotation) would have to be transformed. Transforming the parameters would
> be intractable under a projective transform (e.g. perspective), but since
> we are limitted to affine transforms, it can be done.  Now, in the case of
> a non-invertible CTM, we would end up with radiusX or radiusY or both equal
> to zero.  And what happens when you have that?  Your arcTo just turned into
> lineTo(x1, y1). Tada!

Why does radiusX or radiusY need to be zero? Because you define it that way for a non-invertible matrix? That makes sense for scale(0,0). What about infinity or NaN? If Ian didn’t update the spec then this is still undefined and therefore up to the UA to decide.

Greetings,
Dirk

> 
> 
> 
> 
>> 
> 
> 
> 
>> 
>> --
>> Ian Hickson               U+1047E                )\._.,--....,'``.    fL
>> http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
>> Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'
>> 

Received on Monday, 17 March 2014 15:36:32 UTC