Direction of arc in canvasdraw

Accueil Forums Programmation WIMS Programmation dans le langage wims Direction of arc in canvasdraw

Étiqueté : 

Vous lisez 2 fils de discussion
  • Auteur
    Messages
    • #6123
      eric
      Participant
      Up
      0
      Down
      ::

      Hello,
      I am quite confused about the way the arcs are drawn by userdraw_arcs. When we clic 3 points, the middle one is taken as center and first and third determine two arcs (whose union is a circle).
      My question is: which one is drawn and what is the idea behind the choice?

      I see in the code that (probably due to sign of some atan of angles) it depends on the position of the two « radii » (p1p2 and p2p3) with respect to horizontal axis, so it is not « rotation invariant » (if you turn p1 and p3 by 10° around p2, the angle theta may change to 360°-theta). Is there a pedagogical reason for this choice?
      I would have expected rather for example a counterclockwise arc from p1 to p3 around p2 (i.e. same way of constructing a 90° arc from 85° to 175° or from 95° to 185°, which is not the case now).

      In any case, if the documentation could explain how it works, it would be great!
      Thank you in advance for any explanations.

      Éric

    • #6124
      eric
      Participant
      Up
      0
      Down
      ::

      Hello,
      Just after writing the previous message, I came to the conclusion that a simple way of describing what happens is probably: the chosen arc is the one which doesn’t cross the left horizontal axis from the center. (That might be a begining for a documentation…)
      But what if I want to draw the one which crosses, from 175° to 185°?

      Éric

    • #6125
      jm.evers
      Participant
      Up
      0
      Down
      ::

      Hello Erik,

      You are correct: the command userdraw arc,color could/should be improved!

      The ‘static’ way of using first 3 points (the second point is set to be the center point…) and then afterwards draw the arc is not very practical…and probably the way the ‘direction’ argument to the html5 canvas command arc(xc,yc,radius,start,end,direction) is determined, is not correct.

      As this is all amateur driven opensource stuff, you could just upload any improvements to SVN.
      (as long as the fly-like command syntax is unchanged)

      kind regards,
      Joke

Vous lisez 2 fils de discussion
  • Vous devez être connecté pour répondre à ce sujet.