[whatwg] Canvas arcTo all points on a line

Dirk Schulze vbs85 at gmx.de
Sat Dec 27 06:36:07 PST 2008


I believe adding an infinite far away point is wrong and insteaed
nothing should be drawn at all and I would like to explain my reason:

Imagine 2 vectors. One from (x1, y1) to (x0, y0) and one from (x1, y1)
to (x2, y2).
For

moveTo(100, 0);
arcTo(150,0, 50, 0, 10);

the angle between the two vectors is 0. Now we want to calculate the two
points on the tangents of the circle with the radius r. r is not null
(first point of the specification for arcTo).
Now put it to a system of equations and you won't get a solution. It's
unresolveable. Why is something allowed, that is not calculateable?

The next reason is, that infinite or NaN values are not alowed for
lineTo and moveTo , ... . But it's possible to get support for infinte
indirectly with arcTo (see comment above). And how to deal with a
infinite far away point? A lineTo would never reach this point, it's
infinite far away. Instead we have to draw a line parallel to the
infinite long line, created by arcTo (and it's infinite long too).

Please correct me if I missunderstood the specification.

Dirk

Am Samstag, den 27.12.2008, 10:37 +0100 schrieb Dirk Schulze:
> Hi,
> 
> have two questions to the "all points on a line" part of canvas' arcTo.
> A short example:
> 
> moveTo(50,0);
> arcTo(100,0,  0,0, 10);
> 
> This should add a new, from p1 infinite far away, point to the subpath
> and draw a straight line to it.
> 
> Two questions.
> 
> 1) If I add lineTo(50, 50); after arcTo(..). Wouldn't it draw a "quasi
> parallel" line to the line of arcTo? Because (Xx, Yx) (mentioned in the
> spec) is infinite far away. That means, we will never reach this point
> in reality.
> 
> 2) We don't allow infinite values for moveTo or lineTo, but can make
> this happen with arcTo.
> The example above would be the same as lineTo(-Infinite, 0);
> But we can make moveTo(-Infinite, 0) too with the example above. Just
> make strokeStyle transparent, use arcTo from above and you're done. And
> moveTo(infinite, infinite); would be possible too.
> 
> thanks Dirk




More information about the whatwg mailing list