{-# OPTIONS_GHC -Wall #-}
{-# LANGUAGE Safe #-}
module Physics.Learn.CoordinateSystem
( CoordinateSystem(..)
, standardCartesian
, standardCylindrical
, standardSpherical
, newCoordinateSystem
)
where
import Physics.Learn.Position
( Position
, cartesian
, cartesianCoordinates
, cylindrical
, cylindricalCoordinates
, spherical
, sphericalCoordinates
)
data CoordinateSystem
= CoordinateSystem { CoordinateSystem -> (Double, Double, Double) -> Position
toPosition :: (Double,Double,Double) -> Position
, CoordinateSystem -> Position -> (Double, Double, Double)
fromPosition :: Position -> (Double,Double,Double)
}
standardCartesian :: CoordinateSystem
standardCartesian :: CoordinateSystem
standardCartesian = ((Double, Double, Double) -> Position)
-> (Position -> (Double, Double, Double)) -> CoordinateSystem
CoordinateSystem (Double, Double, Double) -> Position
cartesian Position -> (Double, Double, Double)
cartesianCoordinates
standardCylindrical :: CoordinateSystem
standardCylindrical :: CoordinateSystem
standardCylindrical = ((Double, Double, Double) -> Position)
-> (Position -> (Double, Double, Double)) -> CoordinateSystem
CoordinateSystem (Double, Double, Double) -> Position
cylindrical Position -> (Double, Double, Double)
cylindricalCoordinates
standardSpherical :: CoordinateSystem
standardSpherical :: CoordinateSystem
standardSpherical = ((Double, Double, Double) -> Position)
-> (Position -> (Double, Double, Double)) -> CoordinateSystem
CoordinateSystem (Double, Double, Double) -> Position
spherical Position -> (Double, Double, Double)
sphericalCoordinates
newCoordinateSystem :: ((Double,Double,Double) -> (Double,Double,Double))
-> ((Double,Double,Double) -> (Double,Double,Double))
-> CoordinateSystem
-> CoordinateSystem
newCoordinateSystem :: ((Double, Double, Double) -> (Double, Double, Double))
-> ((Double, Double, Double) -> (Double, Double, Double))
-> CoordinateSystem
-> CoordinateSystem
newCoordinateSystem (Double, Double, Double) -> (Double, Double, Double)
f (Double, Double, Double) -> (Double, Double, Double)
g (CoordinateSystem (Double, Double, Double) -> Position
tp Position -> (Double, Double, Double)
fp)
= ((Double, Double, Double) -> Position)
-> (Position -> (Double, Double, Double)) -> CoordinateSystem
CoordinateSystem ((Double, Double, Double) -> Position
tp forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Double, Double, Double) -> (Double, Double, Double)
g) ((Double, Double, Double) -> (Double, Double, Double)
f forall b c a. (b -> c) -> (a -> b) -> a -> c
. Position -> (Double, Double, Double)
fp)