// Copyright (c) 2008-2015 Barend Gehrels, Amsterdam, the Netherlands.
-// This file was modified by Oracle on 2017, 2018.
-// Modifications copyright (c) 2017-2018, Oracle and/or its affiliates.
+// This file was modified by Oracle on 2017, 2018, 2019.
+// Modifications copyright (c) 2017-2019, Oracle and/or its affiliates.
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle.
// Use, modification and distribution is subject to the Boost Software License,
template <typename T>
struct par_qsc
{
- face_type face;
T a_squared;
T b;
T one_minus_f;
T one_minus_f_squared;
+ face_type face;
};
static const double epsilon10 = 1.e-10;
/* Forward projection, ellipsoid */
- // template class, using CRTP to implement forward/inverse
template <typename T, typename Parameters>
struct base_qsc_ellipsoid
- : public base_t_fi<base_qsc_ellipsoid<T, Parameters>, T, Parameters>
{
par_qsc<T> m_proj_parm;
- inline base_qsc_ellipsoid(const Parameters& par)
- : base_t_fi<base_qsc_ellipsoid<T, Parameters>, T, Parameters>(*this, par)
- {}
-
// FORWARD(e_forward)
// Project coordinates from geographic (lon, lat) to cartesian (x, y)
- inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
+ inline void fwd(Parameters const& par, T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const
{
static const T fourth_pi = detail::fourth_pi<T>();
static const T half_pi = detail::half_pi<T>();
/* Convert the geodetic latitude to a geocentric latitude.
* This corresponds to the shift from the ellipsoid to the sphere
* described in [LK12]. */
- if (this->m_par.es != 0.0) {
+ if (par.es != 0.0) {
lat = atan(this->m_proj_parm.one_minus_f_squared * tan(lp_lat));
} else {
lat = lp_lat;
// INVERSE(e_inverse)
// Project coordinates from cartesian (x, y) to geographic (lon, lat)
- inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
+ inline void inv(Parameters const& par, T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const
{
static const T half_pi = detail::half_pi<T>();
static const T pi = detail::pi<T>();
/* Apply the shift from the sphere to the ellipsoid as described
* in [LK12]. */
- if (this->m_par.es != 0.0) {
+ if (par.es != 0.0) {
int invert_sign;
T tanphi, xa;
invert_sign = (lp_lat < 0.0 ? 1 : 0);
tanphi = tan(lp_lat);
xa = this->m_proj_parm.b / sqrt(tanphi * tanphi + this->m_proj_parm.one_minus_f_squared);
- lp_lat = atan(sqrt(this->m_par.a * this->m_par.a - xa * xa) / (this->m_proj_parm.one_minus_f * xa));
+ lp_lat = atan(sqrt(par.a * par.a - xa * xa) / (this->m_proj_parm.one_minus_f * xa));
if (invert_sign) {
lp_lat = -lp_lat;
}
// Quadrilateralized Spherical Cube
template <typename Parameters, typename T>
- inline void setup_qsc(Parameters& par, par_qsc<T>& proj_parm)
+ inline void setup_qsc(Parameters const& par, par_qsc<T>& proj_parm)
{
static const T fourth_pi = detail::fourth_pi<T>();
static const T half_pi = detail::half_pi<T>();
{
template <typename Params>
inline qsc_ellipsoid(Params const& , Parameters const& par)
- : detail::qsc::base_qsc_ellipsoid<T, Parameters>(par)
{
- detail::qsc::setup_qsc(this->m_par, this->m_proj_parm);
+ detail::qsc::setup_qsc(par, this->m_proj_parm);
}
};
{
// Static projection
- BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION(srs::spar::proj_qsc, qsc_ellipsoid, qsc_ellipsoid)
+ BOOST_GEOMETRY_PROJECTIONS_DETAIL_STATIC_PROJECTION_FI(srs::spar::proj_qsc, qsc_ellipsoid)
// Factory entry(s)
BOOST_GEOMETRY_PROJECTIONS_DETAIL_FACTORY_ENTRY_FI(qsc_entry, qsc_ellipsoid)