Annotation of rpl/src/fonctions_trigonometriques.c, revision 1.1

1.1     ! bertrand    1: /*
        !             2: ================================================================================
        !             3:   RPL/2 (R) version 4.0.9
        !             4:   Copyright (C) 1989-2010 Dr. BERTRAND Joël
        !             5: 
        !             6:   This file is part of RPL/2.
        !             7: 
        !             8:   RPL/2 is free software; you can redistribute it and/or modify it
        !             9:   under the terms of the CeCILL V2 License as published by the french
        !            10:   CEA, CNRS and INRIA.
        !            11:  
        !            12:   RPL/2 is distributed in the hope that it will be useful, but WITHOUT
        !            13:   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
        !            14:   FITNESS FOR A PARTICULAR PURPOSE.  See the CeCILL V2 License
        !            15:   for more details.
        !            16:  
        !            17:   You should have received a copy of the CeCILL License
        !            18:   along with RPL/2. If not, write to info@cecill.info.
        !            19: ================================================================================
        !            20: */
        !            21: 
        !            22: 
        !            23: #include "rpl.conv.h"
        !            24: 
        !            25: 
        !            26: /*
        !            27: ================================================================================
        !            28:   Fonction de conversion d'un angle exprimé en radians en degrés
        !            29: ================================================================================
        !            30:   Entrées : pointeur sur l'angle
        !            31: --------------------------------------------------------------------------------
        !            32:   Sorties : néant
        !            33: --------------------------------------------------------------------------------
        !            34:   Effets de bord : néant
        !            35: ================================================================================
        !            36: */
        !            37: 
        !            38: void
        !            39: conversion_radians_vers_degres(real8 *angle)
        !            40: {
        !            41:    (*angle) = 45 * (*angle) / atan((real8) 1);
        !            42: 
        !            43:    return;
        !            44: }
        !            45: 
        !            46: 
        !            47: /*
        !            48: ================================================================================
        !            49:   Fonction de conversion d'un angle exprimé en degrés en radians
        !            50: ================================================================================
        !            51:   Entrées : pointeur sur l'angle
        !            52: --------------------------------------------------------------------------------
        !            53:   Sorties : néant
        !            54: --------------------------------------------------------------------------------
        !            55:   Effets de bord : néant
        !            56: ================================================================================
        !            57: */
        !            58: 
        !            59: void
        !            60: conversion_degres_vers_radians(real8 *angle)
        !            61: {
        !            62:    (*angle) = atan((real8) 1) * (*angle) / 45;
        !            63: 
        !            64:    return;
        !            65: }
        !            66: 
        !            67: 
        !            68: /*
        !            69: ================================================================================
        !            70:   Fonction de conversion d'un angle exprimé en decimal en HMS
        !            71: ================================================================================
        !            72:   Entrées : pointeur sur l'angle
        !            73: --------------------------------------------------------------------------------
        !            74:   Sorties : néant
        !            75: --------------------------------------------------------------------------------
        !            76:   Effets de bord : néant
        !            77: ================================================================================
        !            78: */
        !            79: 
        !            80: void
        !            81: conversion_decimal_vers_hms(real8 *angle)
        !            82: {
        !            83:    real8                       heures;
        !            84:    real8                       minutes;
        !            85:    real8                       reste;
        !            86:    real8                       secondes;
        !            87: 
        !            88:    integer4                    signe;
        !            89: 
        !            90:    signe = ((*angle) >= 0) ? 1 : -1;
        !            91:    (*angle) *= signe;
        !            92: 
        !            93:    reste = (*angle) - (heures = floor(*angle));
        !            94:    minutes = floor(reste *= 60);
        !            95:    reste -= minutes;
        !            96:    secondes = floor(reste = 60 * reste);
        !            97:    reste -= secondes;
        !            98: 
        !            99:    (*angle) = (heures + ((minutes + ((secondes + reste) / 100)) / 100))
        !           100:            * signe;
        !           101: 
        !           102:    return;
        !           103: }
        !           104: 
        !           105: 
        !           106: /*
        !           107: ================================================================================
        !           108:   Fonction de conversion d'un angle exprimé en HMS en décimal
        !           109: ================================================================================
        !           110:   Entrées : pointeur sur l'angle
        !           111: --------------------------------------------------------------------------------
        !           112:   Sorties : néant
        !           113: --------------------------------------------------------------------------------
        !           114:   Effets de bord : néant
        !           115: ================================================================================
        !           116: */
        !           117: 
        !           118: void
        !           119: conversion_hms_vers_decimal(real8 *angle)
        !           120: {
        !           121:    real8                       minutes;
        !           122:    real8                       secondes;
        !           123:    real8                       reste;
        !           124:    real8                       heures;
        !           125: 
        !           126:    integer4                    signe;
        !           127: 
        !           128:    signe = ((*angle) >= 0) ? 1 : -1;
        !           129:    (*angle) *= signe;
        !           130: 
        !           131:    reste = (*angle) - (heures = floor(*angle));
        !           132:    minutes = floor(reste *= 100);
        !           133:    reste -= minutes;
        !           134:    secondes = floor(reste = 100 * reste);
        !           135:    reste -= secondes;
        !           136: 
        !           137:    (*angle) = (heures + ((minutes + ((secondes + reste) / 60)) / 60)) * signe;
        !           138: 
        !           139:    return;
        !           140: }
        !           141: 
        !           142: // vim: ts=4

CVSweb interface <joel.bertrand@systella.fr>