Skip to content

Instantly share code, notes, and snippets.

@fenrir-naru
Created February 16, 2018 08:56
Show Gist options
  • Save fenrir-naru/ec91ed7cf61daa3bdd629ff0ea718c3f to your computer and use it in GitHub Desktop.
Save fenrir-naru/ec91ed7cf61daa3bdd629ff0ea718c3f to your computer and use it in GitHub Desktop.
SBAS interpolation of ionospheric grid points
struct rectangle_t {
/**
* igp[2] -- igp[3] igp[0] -- igp[1]
* | | in north, | | in south
* igp[0] -- igp[1] igp[2] -- igp[3]
*
* assumption
* igp[0].lat = igp[1].lat, igp[2].lat = igp[3].lat
* igp[0].lng < igp[1].lng, igp[2].lng < igp[3].lng
*/
position_t igp[4];
float_t weight[4];
void compute_weight(const float_t &delta_lat_from_0, const float_t &delta_lng_from_0){
// (A-25)-(A-32)
int_t
delta_lng10(igp[1].longitude_deg - igp[0].longitude_deg),
delta_lng23(igp[2].longitude_deg - igp[3].longitude_deg);
float_t
w_lat23(delta_lat_from_0 / (igp[2].latitude_deg - igp[0].latitude_deg)),
w_lat01(1. - w_lat23),
w_lng32(delta_lng_from_0 / (igp[2].longitude_deg - igp[3].longitude_deg)),
w_lng10(delta_lng_from_0 / (igp[1].longitude_deg - igp[0].longitude_deg));
// res = ((1. - w_lng10) * [0] + w_lng10 * [1]) * (1. - w_lat23) + ((1. - w_lng32) * [2] + w_lng32 * [3]) * w_lat23;
weight[0] = (1. - w_lng10) * w_lat01;
weight[1] = w_lng10 * w_lat01;
weight[2] = (1. - w_lng32) * w_lat23;
weight[3] = w_lng32 * w_lat23;
}
};
void interpolate(const float_t &latitude_deg, const float_t &longitude_deg) const { // TODO return type
pivot_t base(pivot(latitude_deg, longitude_deg));
if(base.igp.latitude_deg == 85){
}else if(base.igp.latitude_deg == -85){
}else if(base.igp.latitude_deg == 75){
}else if(base.igp.latitude_deg == -75){
}else if(base.igp.latitude_deg >= 60){
}else if(base.igp.latitude_deg <= -60){
}else if(base.igp.latitude_deg >= 0){
}else{
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment