{-# LANGUAGE CApiFFI #-}
module OpenCascade.BRepPrimAPI.MakeCylinder
( fromRadiusAndHeight
) where

import qualified OpenCascade.TopoDS as TopoDS
import qualified OpenCascade.TopoDS.Internal.Destructors as TopoDS.Destructors
import Foreign.C
import Foreign.Ptr
import Data.Acquire 
import Data.Coerce (coerce)

foreign import capi unsafe "hs_BRepPrimAPI_MakeCylinder.h hs_BRepPrimAPI_MakeCylinder_fromRadiusAndHeight" rawFromRadiusAndHeight :: CDouble -> CDouble -> IO (Ptr TopoDS.Solid)

fromRadiusAndHeight :: Double -> Double -> Acquire (Ptr TopoDS.Solid)
fromRadiusAndHeight :: Double -> Double -> Acquire (Ptr Solid)
fromRadiusAndHeight Double
r Double
h = IO (Ptr Solid) -> (Ptr Solid -> IO ()) -> Acquire (Ptr Solid)
forall a. IO a -> (a -> IO ()) -> Acquire a
mkAcquire (CDouble -> CDouble -> IO (Ptr Solid)
rawFromRadiusAndHeight (Double -> CDouble
forall a b. Coercible a b => a -> b
coerce Double
r) (Double -> CDouble
forall a b. Coercible a b => a -> b
coerce Double
h)) (Ptr Shape -> IO ()
TopoDS.Destructors.deleteShape (Ptr Shape -> IO ())
-> (Ptr Solid -> Ptr Shape) -> Ptr Solid -> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Ptr Solid -> Ptr Shape
forall a b. Ptr a -> Ptr b
castPtr)