From: Denis Davydov Date: Fri, 27 Jan 2017 12:16:12 +0000 (+0100) Subject: explicitly mention Spherical-Cartesian transformation X-Git-Tag: v8.5.0-rc1~198^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F3858%2Fhead;p=dealii.git explicitly mention Spherical-Cartesian transformation --- diff --git a/include/deal.II/base/geometric_utilities.h b/include/deal.II/base/geometric_utilities.h index 2dc55c40b2..76b4d9a6a6 100644 --- a/include/deal.II/base/geometric_utilities.h +++ b/include/deal.II/base/geometric_utilities.h @@ -45,6 +45,13 @@ namespace GeometricUtilities * Return spherical coordinates of a Cartesian point @p point. * The returned array is filled with radius, azimuth angle $\in [0,2 \pi)$ * and polar/inclination angle $ \in [0,\pi]$ (ommited in 2D). + * + * In 3D the transformation is given by + * @f{align*} + * r &= \sqrt{x^2+y^2+z^2} \\ + * \theta &= {\rm atan}(y/x) \\ + * \phi &= {\rm acos} (z/r) + * @f} */ template std_cxx11::array @@ -52,9 +59,16 @@ namespace GeometricUtilities /** * Return the Cartesian coordinates of a spherical point defined by @p scoord - * which is filled with radius $\in [0,\infty)$, azimuth angle - * $\in [0,2 \pi)$ and polar/inclination angle $\in [0,\pi]$ + * which is filled with radius $r \in [0,\infty)$, azimuth angle + * $\theta \in [0,2 \pi)$ and polar/inclination angle $\phi \in [0,\pi]$ * (ommited in 2D). + * + * In 3D the transformation is given by + * @f{align*} + * x &= r\, \cos(\theta) \, \sin(\phi) \\ + * y &= r\, \sin(\theta) \, \sin(\phi) \\ + * z &= r\, \cos(\phi) + * @f} */ template Point diff --git a/source/base/geometric_utilities.cc b/source/base/geometric_utilities.cc index 427cdf2ca5..d136537cd4 100644 --- a/source/base/geometric_utilities.cc +++ b/source/base/geometric_utilities.cc @@ -47,13 +47,13 @@ namespace GeometricUtilities // radius scoord[0] = position.norm(); - // azimuth angle + // azimuth angle \theta: scoord[1] = std::atan2(position(1),position(0)); // correct to [0,2*pi) if (scoord[1] < 0.0) scoord[1] += 2.0*numbers::PI; - // polar angle + // polar angle \phi: if (dim==3) { // acos returns the angle in the range [0,\pi]