* Copyright (C) 2012, 2014 PX4 Development Team. All rights reserved.
* Copyright (c) 2012-2014 PX4 Development Team. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
...
...
@@ -49,39 +49,124 @@
#include<stdio.h>
#include<math.h>
#include<stdbool.h>
#include<string.h>
#include<float.h>
#include<systemlib/err.h>
#include<drivers/drv_hrt.h>
/*
* Azimuthal Equidistant Projection
* formulas according to: http://mathworld.wolfram.com/AzimuthalEquidistantProjection.html
*/
__EXPORTvoidmap_projection_init(structmap_projection_reference_s*ref,doublelat_0,doublelon_0)//lat_0, lon_0 are expected to be in correct format: -> 47.1234567 and not 471234567
__EXPORTintmap_projection_global_init(doublelat_0,doublelon_0,uint64_ttimestamp)//lat_0, lon_0 are expected to be in correct format: -> 47.1234567 and not 471234567
__EXPORTintmap_projection_init_timestamped(structmap_projection_reference_s*ref,doublelat_0,doublelon_0,uint64_ttimestamp)//lat_0, lon_0 are expected to be in correct format: -> 47.1234567 and not 471234567
{
doublelat_rad=lat/180.0*M_PI;
doublelon_rad=lon/180.0*M_PI;
ref->lat_rad=lat_0*M_DEG_TO_RAD;
ref->lon_rad=lon_0*M_DEG_TO_RAD;
ref->sin_lat=sin(ref->lat_rad);
ref->cos_lat=cos(ref->lat_rad);
ref->timestamp=timestamp;
ref->init_done=true;
return0;
}
__EXPORTintmap_projection_init(structmap_projection_reference_s*ref,doublelat_0,doublelon_0)//lat_0, lon_0 are expected to be in correct format: -> 47.1234567 and not 471234567