Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SphericalCoordinates: make query methods const #452

Merged
merged 1 commit into from
Jul 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions include/gz/math/SphericalCoordinates.hh
Original file line number Diff line number Diff line change
Expand Up @@ -199,19 +199,19 @@ namespace gz

/// \brief Get the radius of the surface.
/// \return radius of the surface in use.
public: double SurfaceRadius();
public: double SurfaceRadius() const;

/// \brief Get the major axis of the surface.
/// \return Equatorial axis of the surface in use.
public: double SurfaceAxisEquatorial();
public: double SurfaceAxisEquatorial() const;

/// \brief Get the minor axis of the surface.
/// \return Polar axis of the surface in use.
public: double SurfaceAxisPolar();
public: double SurfaceAxisPolar() const;

/// \brief Get the flattening of the surface.
/// \return Flattening parameter of the surface in use.
public: double SurfaceFlattening();
public: double SurfaceFlattening() const;

/// \brief Get reference geodetic latitude.
/// \return Reference geodetic latitude.
Expand Down
10 changes: 6 additions & 4 deletions src/SphericalCoordinates.cc
Original file line number Diff line number Diff line change
Expand Up @@ -434,8 +434,10 @@ double SphericalCoordinates::Distance(const gz::math::Angle &_latA,
const gz::math::Angle &_latB,
const gz::math::Angle &_lonB)
{
// LCOV_EXCL_START
return gz::math::SphericalCoordinates::DistanceWGS84(
_latA, _lonA, _latB, _lonB);
// LCOV_EXCL_STOP
}

//////////////////////////////////////////////////
Expand All @@ -460,25 +462,25 @@ double SphericalCoordinates::DistanceBetweenPoints(
}

//////////////////////////////////////////////////
double SphericalCoordinates::SurfaceRadius()
double SphericalCoordinates::SurfaceRadius() const
{
return this->dataPtr->surfaceRadius;
}

//////////////////////////////////////////////////
double SphericalCoordinates::SurfaceAxisEquatorial()
double SphericalCoordinates::SurfaceAxisEquatorial() const
{
return this->dataPtr->ellA;
}

//////////////////////////////////////////////////
double SphericalCoordinates::SurfaceAxisPolar()
double SphericalCoordinates::SurfaceAxisPolar() const
{
return this->dataPtr->ellB;
}

//////////////////////////////////////////////////
double SphericalCoordinates::SurfaceFlattening()
double SphericalCoordinates::SurfaceFlattening() const
{
return this->dataPtr->ellF;
}
Expand Down