[whatwg] Canvas arcTo all points on a line

Calogero Alex Baldacchino alex.baldacchino at email.it
Wed Jan 21 12:18:16 PST 2009


Philip Taylor ha scritto:
>
> But I don't know if it makes sense from the perspective of someone
> who's got to write an independent implementation of it. Does the above
> explanation make more sense than the text in the spec? and if so, does
> it seem implementable? If so, it seems best to keep the spec's
> behaviour and try to clarify the spec's text. But this doesn't seem
> like an important case where users will be unhappy if e.g. the arcTo
> call draws nothing when all the points are on the same line, so if
> it's still a pain to implement the spec's behaviour then I would be
> happy with changing what the spec requires.
>
>   

I haven't checked this part of the spec insofar; looking at the image 
you posted it seems the 3 points are used as control points in a 
somewhat algorithm to draw curve lines; personally, thinking to an API 
function to draw arcs, I prefer to have the specified points as being 
part of the arc itself (e.g., the two external ones are the extremes of 
a convex elliptical arc). Anyway, certainly what you say makes sense for 
an arc degenering to a line (that is, if all points lay on the same 
line). Assuming the angular coefficient and the start point of the line 
are known, it is easy to find the intersection between it and a clip 
region (through the mean-point algorithm) -- it should be the same with 
a (x2, y2) point very close with the (x0, y0)--(x1, y1) segment, that is 
if under a certain threshold one can't drow an arc and instead the 
result must be approximated to a half-infinite line (I think all an 
implementation needs is to remember an infinite line has been drawn and 
the last point in the subpath is infinitely far, so it can draw a 
parallel line when .lineTo() is invocked).

WBR, Alex
 
 
 --
 Caselle da 1GB, trasmetti allegati fino a 3GB e in piu' IMAP, POP3 e SMTP autenticato? GRATIS solo con Email.it http://www.email.it/f
 
 Sponsor:
 Con Danone Activia, puoi vincere cellulari Nokia e Macbook Air. Scopri come
 Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=8549&d=21-1



More information about the whatwg mailing list