Page 1 sur 1

accel et radius

Posté : dim. 25 nov. 2012, 19:25
par zariski
Il me semble que ma demande précédente sur un autre post est passée inaperçue, aussi je la réitère :
SVP Que donnent : pair accel(path p, int t, int sign=0); et real radius(path p, real t); ?
Perso j'ai compris que le premier donnait un vecteur accélération alors que le second donnait un rayon de courbure.
Problème, j'obtiens des trucs farfelus ....

Re: accel et radius

Posté : dim. 25 nov. 2012, 19:38
par GM
zariski a écrit :Problème, j'obtiens des trucs farfelus ....
Par rapport à ??

De la lecture sur la notion d'accélération :

http://www.vsmp.ch/crm/Articles_bul/B94_MYB.pdf

et deux traces de choses que j'ai cru comprendre :

http://docs.gmaths.net/tempo/courbe_bezier.pdf

Figure asymptote 067b939d77919894df9009fb164c1563
*** Pour masquer/découvrir le code Asymptote qui a permis de créer la figure, il faut cliquer dessus. ;-) ***

CODE ASYMPTOTE de la figure ci-dessus : Tout sélectionner
  1. // Fonction accel
  2.  
  3. // Syntaxe 1 : pair accel(path p, int t, int sign=0);
  4. // If sign < 0, return the acceleration of the incoming path p at node t ;
  5. // if sign > 0, return the acceleration of the outgoing path.
  6. // if sign=0, the mean of these two accelerations is returned.
  7.  
  8. // Syntaxe 2 : pair accel(path p, real t);
  9. // returns the acceleration of the path p at the point t.
  10.  
  11. import geometry;
  12. size(10cm,0);
  13. path p=(-5,0)..(10,0)..(10,10)..(0,20)..(-10,20)..(-5,15)..cycle;
  14. draw("p",p); dot(p,2bp+black);
  15. pair po, pa;
  16. for(real k=0; k<length(p); k+=.05)
  17. {
  18. po=point(p,k);
  19. pa = po+(accel(p,k))/6;
  20. draw(po--pa,red);
  21. }
  22. void acceleration(path p, int k, real t){
  23. pair z0=point(p,k),
  24. c0=postcontrol(p,k),
  25. z1=point(p,k+1),
  26. c1=precontrol(p,k+1),
  27. m0=(1-t)*z0+t*c0,
  28. m1=(1-t)*c0+t*c1,
  29. m2=(1-t)*c1+t*z1,
  30. m3=(1-t)*m0+t*m1,
  31. m4=(1-t)*m1+t*m2,
  32. z2=(1-t)*m3+t*m4;
  33. path CourbeBezier = z0 .. controls c0 and c1 .. z1;
  34. draw(CourbeBezier,1bp+blue);
  35. path lignebrisee = z0 -- c0 -- c1 -- z1;
  36. draw(lignebrisee^^m0--m1--m2^^m3--m4,linetype("4 4"));
  37. dot(z0^^z1^^z2,blue); dot(c0^^c1,gray);
  38. dot(m0--m1--m2^^m3--m4,green);
  39. draw(z2--(z2+accel(CourbeBezier,t)/6),.8bp+.5green,Arrow());
  40. write((precontrol(p,k)+postcontrol(p,k))/2-point(p,k));
  41. }
  42. acceleration(p,1,.75);
  43. acceleration(p,3,.75);
  44. acceleration(p,5,.75);
  45. addMargins(2mm,2mm);


Un sujet de discussion où il a été question de la fonction accel : http://sourceforge.net/projects/asympto ... ic/4782302 où il a été donné
  • un lien vers les définitions d'accel :

    Code : Tout sélectionner

    286     pair accel(Int t, Int sign) const {
    287       if(sign == 0) return 0.5*(preaccel(t)+postaccel(t));
    288       if(sign > 0) return postaccel(t);
    289       return preaccel(t);
    290     }
    291   
    292     pair accel(double t) const {
    293       if(!cycles) {
    294         if(t <= 0) return postaccel((Int) 0);
    295         if(t >= n-1) return preaccel(n-1);
    296       }
    297       Int i=Floor(t);
    298       t -= i;
    299       if(t == 0) return 0.5*(postaccel(i)+preaccel(i));
    300       pair z0=point(i);
    301       pair c0=postcontrol(i);
    302       pair c1=precontrol(i+1);
    303       pair z1=point(i+1);
    304       return 6.0*t*(z1-z0+3.0*(c0-c1))+6.0*(z0+c1)-12.0*c0;
    305     }
  • une réponse (dernier message) à une question que je me posais.

Je ne pourrai pas mieux expliquer... et je n'ai surtout pas de temps en ce moment, pour proposer mieux.

Re: accel et radius

Posté : dim. 25 nov. 2012, 19:53
par zariski
merci pour la réponse...
Je ne pense pas utiliser ces notions tous les jours, aussi je m'en passerai certainement volontiers ! :D
Bonne soirée !