Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
SphericalCoordinates.hh
1 /*
2 This file is part of the BIAS library (Basic ImageAlgorithmS).
3 
4 Copyright (C) 2003-2009 (see file CONTACT for details)
5  Multimediale Systeme der Informationsverarbeitung
6  Institut fuer Informatik
7  Christian-Albrechts-Universitaet Kiel
8 
9 
10 BIAS is free software; you can redistribute it and/or modify
11 it under the terms of the GNU Lesser General Public License as published by
12 the Free Software Foundation; either version 2.1 of the License, or
13 (at your option) any later version.
14 
15 BIAS is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU Lesser General Public License for more details.
19 
20 You should have received a copy of the GNU Lesser General Public License
21 along with BIAS; if not, write to the Free Software
22 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 */
24 
25 
26 #ifndef __SphericalCoordinates_HH__
27 #define __SphericalCoordinates_HH__
28 
29 #include <Geometry/CoordinateTransform3D.hh>
30 #include <Base/Geometry/HomgPoint3D.hh>
31 
32 
33  namespace BIAS {
34  /** \brief Transformation between affine and spherical coordinates.
35  * \ingroup g_geometry
36  *
37  * Class is able to transform euclidean coordinates into a spherical
38  * coordinates and vice versa. Moreover a CoordinateTransform3D is applied
39  * to the passed coordinates. The CoordinateTransform3D stored internaly
40  * can be understood as the pose of the spherical frame.
41  * Meaning that passing euclidean coordinates of a point will first
42  * transform this coordinates into the local frame defined by the "pose"
43  * and then map them to spherical coordinates.
44  *
45  * The angle references are chosen classically within the local
46  * coordinate frame defined by affineReferenceFrame_: the e_z axis is the
47  * reference for the angle Theta and the e_x axis the reference for the
48  * angle phi in the e_x and e_y plane.
49  *
50  * Convention: In general valid angle ranges lie within (-M_PI, M_PI]
51  *
52  *
53  * \author bartczak 10/2007
54  **/
56  public:
57  /** Sets the "local" coordinate frame of the spherical coordinates.
58  *
59  * GlobalToLocal is applied when mapping to spherical coordinates.
60  * LocalToGlobal is applied when unmapping from spherical coordinates.
61  **/
62  void SetAffineBase(const CoordinateTransform3D& newAffineBase);
63  const CoordinateTransform3D& GetAffineBase() const;
64 
65  /** Method calculates spherical coordinates, hereby phi will lie in the
66  * range (-M_PI, M_PI] while theta lies in [0, M_PI].
67  *
68  * \attention If rho drops below 1e-12 all returned values will be zero.
69  *
70  **/
72  double& rho,
73  double& phi, double& theta) const;
74 
75  /** Calculates the Euclidean ray belonging to the passed angles in the
76  * world coordinate frame. Uses the affineReferenceFrame_ information
77  * to calculate the ray coordinates in the global frame.
78  */
79  void GetCartesianRayFromFullPhi(const double& phi, const double& theta,
80  HomgPoint3D& ray) const;
81 
82 
83  protected:
84  /** Defines the reference frame (see discussion in
85  * CoordinateTransform3D). GlobalToLocal is applied when
86  * GlobalToLocal is applied when mapping to spherical coordinates.
87  * LocalToGlobal is applied when unmapping from spherical coordinates.
88  **/
90  };
91  }
92 
93 
94 #endif
const CoordinateTransform3D & GetAffineBase() const
void GetCartesianRayFromFullPhi(const double &phi, const double &theta, HomgPoint3D &ray) const
Calculates the Euclidean ray belonging to the passed angles in the world coordinate frame...
void SetAffineBase(const CoordinateTransform3D &newAffineBase)
Sets the &quot;local&quot; coordinate frame of the spherical coordinates.
class HomgPoint3D describes a point with 3 degrees of freedom in projective coordinates.
Definition: HomgPoint3D.hh:61
void GetSphericalCoordinatesFullPhi(const HomgPoint3D &point, double &rho, double &phi, double &theta) const
Method calculates spherical coordinates, hereby phi will lie in the range (-M_PI, M_PI] while theta l...
CoordinateTransform3D affineReferenceFrame_
Defines the reference frame (see discussion in CoordinateTransform3D).
Transforms 3d points between two different coodinate systems, e.g.
Transformation between affine and spherical coordinates.