Skip to content
Snippets Groups Projects

v1.1.3

Merged Noah Schick requested to merge nschick/osi-query-library-dev:v1.1.3 into v1.1.x
@@ -85,11 +85,21 @@ double Points<T, From>::GetAngle(double s) const
@@ -85,11 +85,21 @@ double Points<T, From>::GetAngle(double s) const
const Vector2d edge{Norm(*it - *std::prev(it))};
const Vector2d edge{Norm(*it - *std::prev(it))};
--it;
--it;
const Vector2d pre{Norm(it == begin<D>() ? (*std::next(it) - *it) : (*it - *std::prev(it)))};
const Vector2d pre{Norm(it == begin<D>() ? (*std::next(it) - *it) : (*it - *std::prev(it)))};
const double startAngle{(pre + edge).Angle()};
const double endAngle{(edge + post).Angle()};
const double startLatitude{extract<Direction::Downstream>(*it)};
const double startLatitude{extract<Direction::Downstream>(*it)};
const double endLatitude{extract<Direction::Downstream>(*std::next(it))};
const double endLatitude{extract<Direction::Downstream>(*std::next(it))};
const double ratio{(s - startLatitude) / (endLatitude - startLatitude)};
const double ratio{(s - startLatitude) / (endLatitude - startLatitude)};
 
 
double startAngle{(pre + edge).Angle()};
 
double endAngle{(edge + post).Angle()};
 
if (startAngle - endAngle > M_PI)
 
{
 
return std::fmod(startAngle * (1.0 - ratio) + (endAngle + 2.0 * M_PI) * ratio, 2.0 * M_PI);
 
}
 
if (endAngle - startAngle > M_PI)
 
{
 
return std::fmod((startAngle + 2.0 * M_PI) * (1.0 - ratio) + endAngle * ratio, 2.0 * M_PI);
 
}
return startAngle * (1.0 - ratio) + endAngle * ratio;
return startAngle * (1.0 - ratio) + endAngle * ratio;
}
}
}
}
Loading