Pente et Angle

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #252121 quote
    Bernard13
    Participant
    Average

    Bonjour,
    Pouvez-vous valider ou non l’écriture du code de ces trois calculs, j’ai des valeurs d’angles aberrants.

    Slope= ROUND( (Src – Src[1]) / (BarIndex – BarIndex[1]), 2)   // Le delta X est optionnel car je souhaite calculer la pente sur la barre courante et la précédente donc deltaX= 1
    Slope%= ROUND( (Src / Src[1] – 1 )  * 100,  2 )
    Corner= ROUND( ATAN(Slope) * 180/Pi, 2)  // J’ai contrôlé, ATN ou ATN2 n’est pas reconnu, je suis en V12.
    Corner= Corner MOD 360 – 180 n’a rien résolu, j’ai des angles à plus de 360°

    Merci d’avance.

    #252132 quote
    Iván González
    Moderator
    Master

    Dans la plupart des langages, ATAN() renvoie une valeur en radians, et il faut donc multiplier par 180/PI pour la convertir en degrés.
    Mais dans ProRealTime, la fonction ATAN() renvoie déjà directement l’angle en degrés, dans l’intervalle [-90°, +90°].

    La bonne écriture est simplement :

    Corner = ROUND(ATAN(Slope), 2)
    Bernard13 and robertogozzi thanked this post
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.

Pente et Angle


ProBuilder : Indicateurs & Outils Personnalisés

New Reply
Author
author-avatar
Bernard13 @bernard13 Participant
Summary

This topic contains 1 reply,
has 2 voices, and was last updated by Iván González
5 months, 2 weeks ago.

Topic Details
Forum: ProBuilder : Indicateurs & Outils Personnalisés
Language: French
Started: 10/02/2025
Status: Active
Attachments: No files
Logo Logo
Loading...