Révision 314
Ajouté par Romain CHAMBELLON il y a environ 3 ans
main.c | ||
---|---|---|
lat[j] = '\0'; //On ferme bien la chaine
|
||
lng[k] = '\0';
|
||
pos_trame.lat = conv_lat(lat);
|
||
pos_trame.lng = conv_long(lng); //On stocke la latitude et la longitude convertie dans structure position.
|
||
pos_trame.lng = conv_long(lng); //On stocke la latitude et la longitude converties dans structure position.
|
||
return pos_trame;
|
||
}
|
||
}
|
||
|
||
|
||
|
||
float calcul_distance(Position pos_trame1, Position pos_trame2){
|
||
//On utilise la formule en connaissant le rayon de la terre.
|
||
float x = (pos_trame2.lng - pos_trame1.lng) * cos( (pos_trame1.lat + pos_trame2.lat) / 2);
|
||
float y = pos_trame2.lat - pos_trame1.lat;
|
||
float z = sqrt(x*x + y*y);
|
||
float k = 1.852 * 60;
|
||
float d = k * z;
|
||
return d;
|
||
}
|
||
// Ne pas modifier cette fonction
|
||
int main(int argc,char ** argv)
|
||
{
|
Formats disponibles : Unified diff
Question 4 : Fonction calcul_distance en cours en réalisation