[whatwg] [Canvas] Behavior on non-invertable CTM
Justin Novosad
junov at google.com
Mon Mar 17 07:49:54 PDT 2014
On Fri, Mar 14, 2014 at 4:50 PM, Ian Hickson <ian at 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!
>
>
> --
> Ian Hickson U+1047E )\._.,--....,'``. fL
> http://ln.hixie.ch/ U+263A /, _.. \ _\ ;`._ ,.
> Things that are impossible just take longer. `._.-(,_..'--(,_..'`-.;.'
>
More information about the whatwg
mailing list