# Path: imusim/maths/vector_fields.py
# class ConstantVectorField(VectorField):
#     """
#     A vector field wth a constant value everywhere.
#     """
# 
#     def __init__(self, value):
#         """
#         Construct constant field model.
# 
#         @param value: Field value as a 3x1 L{np.ndarray}.
#         """
#         self._value = value
# 
#     def __call__(self, position, t):
#         result = np.empty_like(position)
#         result[:] = self._value
#         return result
# 
#     @property
#     def nominalValue(self):
#         return self._value


import numpy as np
from imusim.maths.vectors import vector
from imusim.maths.vector_fields import ConstantVectorField
# (at your option) any later version.
#
# IMUSim 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with IMUSim.  If not, see <http://www.gnu.org/licenses/>.


""" Standard Earth gravity in m/s^2. """
STANDARD_GRAVITY = 9.81
"""Standard gravitational field magnitdue in M{m/s^2}"""

class ConstantGravitationalField(ConstantVectorField):
    """
    Constant gravitational field model.

    The field is modelled as a parallel vector field with a constant
    magnitude. The field is non-zero only in the z (Down) axis.
    """

    def __init__(self, magnitude=STANDARD_GRAVITY):
        """
        Construct field model.

        @param magnitude: Magnitude of field in m/s^2. Default is standard
            Earth gravity.
        """

# Path: imusim/maths/vector_fields.py
# class ConstantVectorField(VectorField):
#     """
#     A vector field wth a constant value everywhere.
#     """
# 
#     def __init__(self, value):
#         """
#         Construct constant field model.
# 
#         @param value: Field value as a 3x1 L{np.ndarray}.
#         """
#         self._value = value
# 
#     def __call__(self, position, t):
#         result = np.empty_like(position)
#         result[:] = self._value
#         return result
# 
#     @property
#     def nominalValue(self):
#         return self._value


# Path: imusim/environment/gravity.py
import numpy as np
from imusim.maths.vectors import vector
from imusim.maths.vector_fields import ConstantVectorField

# (at your option) any later version.
#
# IMUSim 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with IMUSim.  If not, see <http://www.gnu.org/licenses/>.


""" Standard Earth gravity in m/s^2. """
STANDARD_GRAVITY = 9.81
"""Standard gravitational field magnitdue in M{m/s^2}"""

class ConstantGravitationalField(ConstantVectorField):
    """
    Constant gravitational field model.

    The field is modelled as a parallel vector field with a constant
    magnitude. The field is non-zero only in the z (Down) axis.
    """

    def __init__(self, magnitude=STANDARD_GRAVITY):
        """
        Construct field model.

        @param magnitude: Magnitude of field in m/s^2. Default is standard
            Earth gravity.
        """

        ConstantVectorField.__init__(self, vector(0, 0, magnitude))