Skip to content
Snippets Groups Projects
Commit 49278381 authored by Moritz Hanke's avatar Moritz Hanke
Browse files

small refactoring of routine lat_edge_correction

parent e8019582
No related branches found
No related tags found
No related merge requests found
......@@ -269,6 +269,8 @@ static double lat_edge_correction(
// --> their sign indicates the ordering of vertices
double scalar_base = scalar_product(norm_ab, base_vec);
int negative_correction_flag;
// if the base point is on the same plane as a and b
if (fabs(scalar_base) < 1e-11) {
......@@ -280,22 +282,17 @@ static double lat_edge_correction(
if (compute_norm_vector(middle_lat, pole, norm_middle)) return 0.0;
double scalar_a = scalar_product(norm_middle, a);
if (scalar_a > 0)
return correction;
else
return - correction;
negative_correction_flag = scalar_a <= 0;
} else {
// compute the cosine between the edge norm vector and the lat edge middle
// point
double scalar_middle_lat = scalar_product(norm_ab, middle_lat);
if (scalar_middle_lat < 0)
return correction;
else
return - correction;
negative_correction_flag = scalar_middle_lat >= 0;
}
return negative_correction_flag?-correction:correction;
}
double yac_pole_area(struct yac_grid_cell cell) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment