PathPointAngle()

Syntaxe

Resultat.d = PathPointAngle(Distance.d)
Description
Renvoie l'angle du chemin au point à la distance donnée depuis le début du chemin du dessin vectoriel en cours.

Arguments

Distance.d La distance depuis le début du chemin.

Si ce paramètre est négatif ou plus grand que la longueur totale du chemin, le point de départ/d'arrivé du chemin est renvoyé.
La longueur totale du chemin peut être déterminée avec PathLength().

Valeur de retour

L'angle de la trajectoire au point donné en degrés.
L'angle 0 marque l'axe des X positifs.

Exemple

  If OpenWindow(0, 0, 0, 400, 200, "PathPointAngle", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
    CanvasGadget(0, 0, 0, 400, 200)

    If StartVectorDrawing(CanvasVectorOutput(0))
    
      ; construction du chemin
      MovePathCursor(150, 125)
      AddPathCurve(0, 270, 0, -150, 350, 180)
      
      ; localisation & angle du point sur le chemin
      x = PathPointX(200)
      y = PathPointY(200)
      a = PathPointAngle(200)
      
      ; dessin du chemin
      VectorSourceColor($FF0000FF)
      StrokePath(5)
      
      ; dessiner un marqueur au point dans le chemin
      AddPathCircle(x, y, 10)
      VectorSourceColor($FFFF0000)
      FillPath()
      
      MovePathCursor(x, y)
      AddPathLine(30*Cos(Radian(a)), 30*Sin(Radian(a)), #PB_Path_Relative)
      StrokePath(5)

      StopVectorDrawing()
    EndIf
    
    Repeat
      Event = WaitWindowEvent()
    Until Event = #PB_Event_CloseWindow
  EndIf

Voir aussi

PathPointX(), PathPointY(), PathLength()

OS Supportés

Tous

<- PathLength() - VectorDrawing Index - PathPointX() ->