WUnitSphereCoordinates.h 2.57 KB
Newer Older
Stefan Philips's avatar
Stefan Philips committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
//---------------------------------------------------------------------------
//
// Project: OpenWalnut ( http://www.openwalnut.org )
//
// Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
// For more information see http://www.openwalnut.org/copying
//
// This file is part of OpenWalnut.
//
// OpenWalnut is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// OpenWalnut is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
//
//---------------------------------------------------------------------------

#ifndef WUNITSPHERECOORDINATES_H
#define WUNITSPHERECOORDINATES_H

#include <vector>

30
#include "../../common/math/linearAlgebra/WLinearAlgebra.h"
Mathias Goldau's avatar
Mathias Goldau committed
31

Stefan Philips's avatar
Stefan Philips committed
32 33 34
/**
 * This class stores coordinates on the unit sphere.
 */
35
class WUnitSphereCoordinates // NOLINT
Stefan Philips's avatar
Stefan Philips committed
36 37 38 39 40 41 42 43 44 45
{
// TODO(all): implement test
// friend class WUnitSphereCoordinatesTest;
public:
    /**
     * Default constructor.
     */
    WUnitSphereCoordinates();

    /**
46 47 48
     * Constructor for unit sphere angles.
     * \param theta coordinate
     * \param phi coordinate
Stefan Philips's avatar
Stefan Philips committed
49 50 51 52
     */
    WUnitSphereCoordinates( double theta, double phi );

    /**
Alexander Wiebel's avatar
Alexander Wiebel committed
53 54
     * Constructor for Euclidean coordinates.
     * \param vector Euclidean coordinates
Stefan Philips's avatar
Stefan Philips committed
55
     */
56
    explicit WUnitSphereCoordinates( WVector3d vector );
Stefan Philips's avatar
Stefan Philips committed
57 58 59 60 61 62 63 64

    /**
     * Destructor.
     */
    virtual ~WUnitSphereCoordinates();

    /**
     * Return the theta angle.
65 66
     *
     * \return theta angle
Stefan Philips's avatar
Stefan Philips committed
67 68 69 70 71
     */
    double getTheta() const;

    /**
     * Return the phi angle.
72 73
     *
     * \return phi angle
Stefan Philips's avatar
Stefan Philips committed
74 75 76 77 78
     */
    double getPhi() const;

    /**
     * Set theta angle.
79
     * \param theta Value for theta.
Stefan Philips's avatar
Stefan Philips committed
80 81 82 83 84 85 86 87 88 89
     */
    void setTheta( double theta );

    /**
     * Set phi angle.
     * \param phi Value for phi.
     */
    void setPhi( double phi );

    /**
Alexander Wiebel's avatar
Alexander Wiebel committed
90
     * Returns the stored sphere coordinates as Euclidean coordinates.
91 92
     *
     * \return sphere coordinates in euclidean space
Stefan Philips's avatar
Stefan Philips committed
93
     */
94
    WVector3d getEuclidean() const;
Stefan Philips's avatar
Stefan Philips committed
95 96 97

protected:
private:
98
    /** coordinate */
Stefan Philips's avatar
Stefan Philips committed
99
    double m_theta;
100
    /** coordinate */
Stefan Philips's avatar
Stefan Philips committed
101 102 103 104
    double m_phi;
};

#endif  // WUNITSPHERECOORDINATES_H