-- Produced by boxnd-gen; edit the generator, not this file.

module Box3D.PrismaticJoint
  ( create
  , enableSpring
  , isSpringEnabled
  , setSpringHertz
  , getSpringHertz
  , setSpringDampingRatio
  , getSpringDampingRatio
  , setTargetTranslation
  , getTargetTranslation
  , enableLimit
  , isLimitEnabled
  , getLowerLimit
  , getUpperLimit
  , setLimits
  , enableMotor
  , isMotorEnabled
  , setMotorSpeed
  , getMotorSpeed
  , setMaxMotorForce
  , getMaxMotorForce
  , getMotorForce
  , getTranslation
  , getSpeed
  )

  where

import Foreign
import Foreign.C.Types (CBool(..))
import Box3D.Id (JointId(..), WorldId(..))
import Box3D.Types (PrismaticJointDef)

foreign import ccall unsafe "b3CreatePrismaticJoint"
  c_b3CreatePrismaticJoint :: WorldId -> Ptr PrismaticJointDef -> IO JointId

foreign import ccall unsafe "b3PrismaticJoint_EnableSpring"
  c_b3PrismaticJoint_EnableSpring :: JointId -> CBool -> IO ()

foreign import ccall unsafe "b3PrismaticJoint_IsSpringEnabled"
  c_b3PrismaticJoint_IsSpringEnabled :: JointId -> IO CBool

foreign import ccall unsafe "b3PrismaticJoint_SetSpringHertz"
  c_b3PrismaticJoint_SetSpringHertz :: JointId -> Float -> IO ()

foreign import ccall unsafe "b3PrismaticJoint_GetSpringHertz"
  c_b3PrismaticJoint_GetSpringHertz :: JointId -> IO Float

foreign import ccall unsafe "b3PrismaticJoint_SetSpringDampingRatio"
  c_b3PrismaticJoint_SetSpringDampingRatio :: JointId -> Float -> IO ()

foreign import ccall unsafe "b3PrismaticJoint_GetSpringDampingRatio"
  c_b3PrismaticJoint_GetSpringDampingRatio :: JointId -> IO Float

foreign import ccall unsafe "b3PrismaticJoint_SetTargetTranslation"
  c_b3PrismaticJoint_SetTargetTranslation :: JointId -> Float -> IO ()

foreign import ccall unsafe "b3PrismaticJoint_GetTargetTranslation"
  c_b3PrismaticJoint_GetTargetTranslation :: JointId -> IO Float

foreign import ccall unsafe "b3PrismaticJoint_EnableLimit"
  c_b3PrismaticJoint_EnableLimit :: JointId -> CBool -> IO ()

foreign import ccall unsafe "b3PrismaticJoint_IsLimitEnabled"
  c_b3PrismaticJoint_IsLimitEnabled :: JointId -> IO CBool

foreign import ccall unsafe "b3PrismaticJoint_GetLowerLimit"
  c_b3PrismaticJoint_GetLowerLimit :: JointId -> IO Float

foreign import ccall unsafe "b3PrismaticJoint_GetUpperLimit"
  c_b3PrismaticJoint_GetUpperLimit :: JointId -> IO Float

foreign import ccall unsafe "b3PrismaticJoint_SetLimits"
  c_b3PrismaticJoint_SetLimits :: JointId -> Float -> Float -> IO ()

foreign import ccall unsafe "b3PrismaticJoint_EnableMotor"
  c_b3PrismaticJoint_EnableMotor :: JointId -> CBool -> IO ()

foreign import ccall unsafe "b3PrismaticJoint_IsMotorEnabled"
  c_b3PrismaticJoint_IsMotorEnabled :: JointId -> IO CBool

foreign import ccall unsafe "b3PrismaticJoint_SetMotorSpeed"
  c_b3PrismaticJoint_SetMotorSpeed :: JointId -> Float -> IO ()

foreign import ccall unsafe "b3PrismaticJoint_GetMotorSpeed"
  c_b3PrismaticJoint_GetMotorSpeed :: JointId -> IO Float

foreign import ccall unsafe "b3PrismaticJoint_SetMaxMotorForce"
  c_b3PrismaticJoint_SetMaxMotorForce :: JointId -> Float -> IO ()

foreign import ccall unsafe "b3PrismaticJoint_GetMaxMotorForce"
  c_b3PrismaticJoint_GetMaxMotorForce :: JointId -> IO Float

foreign import ccall unsafe "b3PrismaticJoint_GetMotorForce"
  c_b3PrismaticJoint_GetMotorForce :: JointId -> IO Float

foreign import ccall unsafe "b3PrismaticJoint_GetTranslation"
  c_b3PrismaticJoint_GetTranslation :: JointId -> IO Float

foreign import ccall unsafe "b3PrismaticJoint_GetSpeed"
  c_b3PrismaticJoint_GetSpeed :: JointId -> IO Float

{- | Create a prismatic (slider) joint.
See also b3PrismaticJointDef for details.

Binds @b3CreatePrismaticJoint@.
-}
create
  :: WorldId
  -> PrismaticJointDef
  -> IO JointId
create :: WorldId -> PrismaticJointDef -> IO JointId
create WorldId
a0 PrismaticJointDef
a1 =
  PrismaticJointDef
-> (Ptr PrismaticJointDef -> IO JointId) -> IO JointId
forall a b. Storable a => a -> (Ptr a -> IO b) -> IO b
with PrismaticJointDef
a1 ((Ptr PrismaticJointDef -> IO JointId) -> IO JointId)
-> (Ptr PrismaticJointDef -> IO JointId) -> IO JointId
forall a b. (a -> b) -> a -> b
$ \Ptr PrismaticJointDef
p1 ->
  WorldId -> Ptr PrismaticJointDef -> IO JointId
c_b3CreatePrismaticJoint WorldId
a0 Ptr PrismaticJointDef
p1

{- | Enable\/disable the joint spring.

Binds @b3PrismaticJoint_EnableSpring@.
-}
enableSpring
  :: JointId
  -> Bool
  -- ^ @enableSpring@
  -> IO ()
enableSpring :: JointId -> Bool -> IO ()
enableSpring JointId
a0 Bool
a1 =
  JointId -> CBool -> IO ()
c_b3PrismaticJoint_EnableSpring JointId
a0 (Bool -> CBool
forall a. Num a => Bool -> a
fromBool Bool
a1)

{- | Is the prismatic joint spring enabled or not?

Binds @b3PrismaticJoint_IsSpringEnabled@.
-}
isSpringEnabled
  :: JointId
  -> IO Bool
isSpringEnabled :: JointId -> IO Bool
isSpringEnabled JointId
a0 =
  CBool -> Bool
forall a. (Eq a, Num a) => a -> Bool
toBool (CBool -> Bool) -> IO CBool -> IO Bool
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (JointId -> IO CBool
c_b3PrismaticJoint_IsSpringEnabled JointId
a0)

{- | Set the prismatic joint stiffness in Hertz.
This should usually be less than a quarter of the simulation rate. For example, if the simulation
runs at 60Hz then the joint stiffness should be 15Hz or less.

Binds @b3PrismaticJoint_SetSpringHertz@.
-}
setSpringHertz
  :: JointId
  -> Float
  -- ^ @hertz@
  -> IO ()
setSpringHertz :: JointId -> Float -> IO ()
setSpringHertz JointId
a0 Float
a1 =
  JointId -> Float -> IO ()
c_b3PrismaticJoint_SetSpringHertz JointId
a0 Float
a1

{- | Get the prismatic joint stiffness in Hertz

Binds @b3PrismaticJoint_GetSpringHertz@.
-}
getSpringHertz
  :: JointId
  -> IO Float
getSpringHertz :: JointId -> IO Float
getSpringHertz JointId
a0 =
  JointId -> IO Float
c_b3PrismaticJoint_GetSpringHertz JointId
a0

{- | Set the prismatic joint damping ratio (non-dimensional)

Binds @b3PrismaticJoint_SetSpringDampingRatio@.
-}
setSpringDampingRatio
  :: JointId
  -> Float
  -- ^ @dampingRatio@
  -> IO ()
setSpringDampingRatio :: JointId -> Float -> IO ()
setSpringDampingRatio JointId
a0 Float
a1 =
  JointId -> Float -> IO ()
c_b3PrismaticJoint_SetSpringDampingRatio JointId
a0 Float
a1

{- | Get the prismatic spring damping ratio (non-dimensional)

Binds @b3PrismaticJoint_GetSpringDampingRatio@.
-}
getSpringDampingRatio
  :: JointId
  -> IO Float
getSpringDampingRatio :: JointId -> IO Float
getSpringDampingRatio JointId
a0 =
  JointId -> IO Float
c_b3PrismaticJoint_GetSpringDampingRatio JointId
a0

{- | Set the prismatic joint target translation. Usually in meters.

Binds @b3PrismaticJoint_SetTargetTranslation@.
-}
setTargetTranslation
  :: JointId
  -> Float
  -- ^ @targetTranslation@
  -> IO ()
setTargetTranslation :: JointId -> Float -> IO ()
setTargetTranslation JointId
a0 Float
a1 =
  JointId -> Float -> IO ()
c_b3PrismaticJoint_SetTargetTranslation JointId
a0 Float
a1

{- | Get the prismatic joint target translation. Usually in meters.

Binds @b3PrismaticJoint_GetTargetTranslation@.
-}
getTargetTranslation
  :: JointId
  -> IO Float
getTargetTranslation :: JointId -> IO Float
getTargetTranslation JointId
a0 =
  JointId -> IO Float
c_b3PrismaticJoint_GetTargetTranslation JointId
a0

{- | Enable\/disable a prismatic joint limit

Binds @b3PrismaticJoint_EnableLimit@.
-}
enableLimit
  :: JointId
  -> Bool
  -- ^ @enableLimit@
  -> IO ()
enableLimit :: JointId -> Bool -> IO ()
enableLimit JointId
a0 Bool
a1 =
  JointId -> CBool -> IO ()
c_b3PrismaticJoint_EnableLimit JointId
a0 (Bool -> CBool
forall a. Num a => Bool -> a
fromBool Bool
a1)

{- | Is the prismatic joint limit enabled?

Binds @b3PrismaticJoint_IsLimitEnabled@.
-}
isLimitEnabled
  :: JointId
  -> IO Bool
isLimitEnabled :: JointId -> IO Bool
isLimitEnabled JointId
a0 =
  CBool -> Bool
forall a. (Eq a, Num a) => a -> Bool
toBool (CBool -> Bool) -> IO CBool -> IO Bool
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (JointId -> IO CBool
c_b3PrismaticJoint_IsLimitEnabled JointId
a0)

{- | Get the prismatic joint lower limit

Binds @b3PrismaticJoint_GetLowerLimit@.
-}
getLowerLimit
  :: JointId
  -> IO Float
getLowerLimit :: JointId -> IO Float
getLowerLimit JointId
a0 =
  JointId -> IO Float
c_b3PrismaticJoint_GetLowerLimit JointId
a0

{- | Get the prismatic joint upper limit

Binds @b3PrismaticJoint_GetUpperLimit@.
-}
getUpperLimit
  :: JointId
  -> IO Float
getUpperLimit :: JointId -> IO Float
getUpperLimit JointId
a0 =
  JointId -> IO Float
c_b3PrismaticJoint_GetUpperLimit JointId
a0

{- | Set the prismatic joint limits

Binds @b3PrismaticJoint_SetLimits@.
-}
setLimits
  :: JointId
  -> Float
  -- ^ @lower@
  -> Float
  -- ^ @upper@
  -> IO ()
setLimits :: JointId -> Float -> Float -> IO ()
setLimits JointId
a0 Float
a1 Float
a2 =
  JointId -> Float -> Float -> IO ()
c_b3PrismaticJoint_SetLimits JointId
a0 Float
a1 Float
a2

{- | Enable\/disable a prismatic joint motor

Binds @b3PrismaticJoint_EnableMotor@.
-}
enableMotor
  :: JointId
  -> Bool
  -- ^ @enableMotor@
  -> IO ()
enableMotor :: JointId -> Bool -> IO ()
enableMotor JointId
a0 Bool
a1 =
  JointId -> CBool -> IO ()
c_b3PrismaticJoint_EnableMotor JointId
a0 (Bool -> CBool
forall a. Num a => Bool -> a
fromBool Bool
a1)

{- | Is the prismatic joint motor enabled?

Binds @b3PrismaticJoint_IsMotorEnabled@.
-}
isMotorEnabled
  :: JointId
  -> IO Bool
isMotorEnabled :: JointId -> IO Bool
isMotorEnabled JointId
a0 =
  CBool -> Bool
forall a. (Eq a, Num a) => a -> Bool
toBool (CBool -> Bool) -> IO CBool -> IO Bool
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (JointId -> IO CBool
c_b3PrismaticJoint_IsMotorEnabled JointId
a0)

{- | Set the prismatic joint motor speed, usually in meters per second

Binds @b3PrismaticJoint_SetMotorSpeed@.
-}
setMotorSpeed
  :: JointId
  -> Float
  -- ^ @motorSpeed@
  -> IO ()
setMotorSpeed :: JointId -> Float -> IO ()
setMotorSpeed JointId
a0 Float
a1 =
  JointId -> Float -> IO ()
c_b3PrismaticJoint_SetMotorSpeed JointId
a0 Float
a1

{- | Get the prismatic joint motor speed, usually in meters per second

Binds @b3PrismaticJoint_GetMotorSpeed@.
-}
getMotorSpeed
  :: JointId
  -> IO Float
getMotorSpeed :: JointId -> IO Float
getMotorSpeed JointId
a0 =
  JointId -> IO Float
c_b3PrismaticJoint_GetMotorSpeed JointId
a0

{- | Set the prismatic joint maximum motor force, usually in newtons

Binds @b3PrismaticJoint_SetMaxMotorForce@.
-}
setMaxMotorForce
  :: JointId
  -> Float
  -- ^ @force@
  -> IO ()
setMaxMotorForce :: JointId -> Float -> IO ()
setMaxMotorForce JointId
a0 Float
a1 =
  JointId -> Float -> IO ()
c_b3PrismaticJoint_SetMaxMotorForce JointId
a0 Float
a1

{- | Get the prismatic joint maximum motor force, usually in newtons

Binds @b3PrismaticJoint_GetMaxMotorForce@.
-}
getMaxMotorForce
  :: JointId
  -> IO Float
getMaxMotorForce :: JointId -> IO Float
getMaxMotorForce JointId
a0 =
  JointId -> IO Float
c_b3PrismaticJoint_GetMaxMotorForce JointId
a0

{- | Get the prismatic joint current motor force, usually in newtons

Binds @b3PrismaticJoint_GetMotorForce@.
-}
getMotorForce
  :: JointId
  -> IO Float
getMotorForce :: JointId -> IO Float
getMotorForce JointId
a0 =
  JointId -> IO Float
c_b3PrismaticJoint_GetMotorForce JointId
a0

{- | Get the current joint translation, usually in meters.

Binds @b3PrismaticJoint_GetTranslation@.
-}
getTranslation
  :: JointId
  -> IO Float
getTranslation :: JointId -> IO Float
getTranslation JointId
a0 =
  JointId -> IO Float
c_b3PrismaticJoint_GetTranslation JointId
a0

{- | Get the current joint translation speed, usually in meters per second.

Binds @b3PrismaticJoint_GetSpeed@.
-}
getSpeed
  :: JointId
  -> IO Float
getSpeed :: JointId -> IO Float
getSpeed JointId
a0 =
  JointId -> IO Float
c_b3PrismaticJoint_GetSpeed JointId
a0