{-# LANGUAGE TypeApplications #-}


-- | Copyright  : Will Thompson and Iñaki García Etxebarria
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria
-- 
-- A sphere, represented by its center and radius.
-- 
-- /Since: 1.2/

#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif

module GI.Graphene.Structs.Sphere
    ( 

-- * Exported types
    Sphere(..)                              ,
    newZeroSphere                           ,


 -- * Methods
-- | 
-- 
--  === __Click to display all available methods, including inherited ones__
-- ==== Methods
-- [containsPoint]("GI.Graphene.Structs.Sphere#g:method:containsPoint"), [distance]("GI.Graphene.Structs.Sphere#g:method:distance"), [equal]("GI.Graphene.Structs.Sphere#g:method:equal"), [free]("GI.Graphene.Structs.Sphere#g:method:free"), [init]("GI.Graphene.Structs.Sphere#g:method:init"), [initFromPoints]("GI.Graphene.Structs.Sphere#g:method:initFromPoints"), [initFromVectors]("GI.Graphene.Structs.Sphere#g:method:initFromVectors"), [isEmpty]("GI.Graphene.Structs.Sphere#g:method:isEmpty"), [translate]("GI.Graphene.Structs.Sphere#g:method:translate").
-- 
-- ==== Getters
-- [getBoundingBox]("GI.Graphene.Structs.Sphere#g:method:getBoundingBox"), [getCenter]("GI.Graphene.Structs.Sphere#g:method:getCenter"), [getRadius]("GI.Graphene.Structs.Sphere#g:method:getRadius").
-- 
-- ==== Setters
-- /None/.

#if defined(ENABLE_OVERLOADING)
    ResolveSphereMethod                     ,
#endif

-- ** alloc #method:alloc#

    sphereAlloc                             ,


-- ** containsPoint #method:containsPoint#

#if defined(ENABLE_OVERLOADING)
    SphereContainsPointMethodInfo           ,
#endif
    sphereContainsPoint                     ,


-- ** distance #method:distance#

#if defined(ENABLE_OVERLOADING)
    SphereDistanceMethodInfo                ,
#endif
    sphereDistance                          ,


-- ** equal #method:equal#

#if defined(ENABLE_OVERLOADING)
    SphereEqualMethodInfo                   ,
#endif
    sphereEqual                             ,


-- ** free #method:free#

#if defined(ENABLE_OVERLOADING)
    SphereFreeMethodInfo                    ,
#endif
    sphereFree                              ,


-- ** getBoundingBox #method:getBoundingBox#

#if defined(ENABLE_OVERLOADING)
    SphereGetBoundingBoxMethodInfo          ,
#endif
    sphereGetBoundingBox                    ,


-- ** getCenter #method:getCenter#

#if defined(ENABLE_OVERLOADING)
    SphereGetCenterMethodInfo               ,
#endif
    sphereGetCenter                         ,


-- ** getRadius #method:getRadius#

#if defined(ENABLE_OVERLOADING)
    SphereGetRadiusMethodInfo               ,
#endif
    sphereGetRadius                         ,


-- ** init #method:init#

#if defined(ENABLE_OVERLOADING)
    SphereInitMethodInfo                    ,
#endif
    sphereInit                              ,


-- ** initFromPoints #method:initFromPoints#

#if defined(ENABLE_OVERLOADING)
    SphereInitFromPointsMethodInfo          ,
#endif
    sphereInitFromPoints                    ,


-- ** initFromVectors #method:initFromVectors#

#if defined(ENABLE_OVERLOADING)
    SphereInitFromVectorsMethodInfo         ,
#endif
    sphereInitFromVectors                   ,


-- ** isEmpty #method:isEmpty#

#if defined(ENABLE_OVERLOADING)
    SphereIsEmptyMethodInfo                 ,
#endif
    sphereIsEmpty                           ,


-- ** translate #method:translate#

#if defined(ENABLE_OVERLOADING)
    SphereTranslateMethodInfo               ,
#endif
    sphereTranslate                         ,




    ) where

import Data.GI.Base.ShortPrelude
import qualified Data.GI.Base.ShortPrelude as SP
import qualified Data.GI.Base.Overloading as O
import qualified Prelude as P

import qualified Data.GI.Base.Attributes as GI.Attributes
import qualified Data.GI.Base.BasicTypes as B.Types
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GArray as B.GArray
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GHashTable as B.GHT
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.GI.Base.Properties as B.Properties
import qualified Data.GI.Base.Signals as B.Signals
import qualified Control.Monad.IO.Class as MIO
import qualified Data.Coerce as Coerce
import qualified Data.Text as T
import qualified Data.Kind as DK
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP
import qualified GHC.OverloadedLabels as OL
import qualified GHC.Records as R
import qualified Data.Word as DW
import qualified Data.Int as DI
import qualified System.Posix.Types as SPT
import qualified Foreign.C.Types as FCT

-- Workaround for https://gitlab.haskell.org/ghc/ghc/-/issues/23392
#if MIN_VERSION_base(4,18,0)
import {-# SOURCE #-} qualified GI.Graphene.Structs.Box as Graphene.Box
import {-# SOURCE #-} qualified GI.Graphene.Structs.Point as Graphene.Point
import {-# SOURCE #-} qualified GI.Graphene.Structs.Point3D as Graphene.Point3D
import {-# SOURCE #-} qualified GI.Graphene.Structs.Rect as Graphene.Rect
import {-# SOURCE #-} qualified GI.Graphene.Structs.Size as Graphene.Size
import {-# SOURCE #-} qualified GI.Graphene.Structs.Vec2 as Graphene.Vec2
import {-# SOURCE #-} qualified GI.Graphene.Structs.Vec3 as Graphene.Vec3
import {-# SOURCE #-} qualified GI.Graphene.Structs.Vec4 as Graphene.Vec4

#else
import {-# SOURCE #-} qualified GI.Graphene.Structs.Box as Graphene.Box
import {-# SOURCE #-} qualified GI.Graphene.Structs.Point3D as Graphene.Point3D
import {-# SOURCE #-} qualified GI.Graphene.Structs.Vec3 as Graphene.Vec3

#endif

-- | Memory-managed wrapper type.
newtype Sphere = Sphere (SP.ManagedPtr Sphere)
    deriving (Sphere -> Sphere -> Bool
(Sphere -> Sphere -> Bool)
-> (Sphere -> Sphere -> Bool) -> Eq Sphere
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Sphere -> Sphere -> Bool
== :: Sphere -> Sphere -> Bool
$c/= :: Sphere -> Sphere -> Bool
/= :: Sphere -> Sphere -> Bool
Eq)

instance SP.ManagedPtrNewtype Sphere where
    toManagedPtr :: Sphere -> ManagedPtr Sphere
toManagedPtr (Sphere ManagedPtr Sphere
p) = ManagedPtr Sphere
p

foreign import ccall "graphene_sphere_get_type" c_graphene_sphere_get_type :: 
    IO GType

type instance O.ParentTypes Sphere = '[]
instance O.HasParentTypes Sphere

instance B.Types.TypedObject Sphere where
    glibType :: IO GType
glibType = IO GType
c_graphene_sphere_get_type

instance B.Types.GBoxed Sphere

-- | Convert t'Sphere' to and from 'Data.GI.Base.GValue.GValue'. See 'Data.GI.Base.GValue.toGValue' and 'Data.GI.Base.GValue.fromGValue'.
instance B.GValue.IsGValue (Maybe Sphere) where
    gvalueGType_ :: IO GType
gvalueGType_ = IO GType
c_graphene_sphere_get_type
    gvalueSet_ :: Ptr GValue -> Maybe Sphere -> IO ()
gvalueSet_ Ptr GValue
gv Maybe Sphere
P.Nothing = Ptr GValue -> Ptr Sphere -> IO ()
forall a. Ptr GValue -> Ptr a -> IO ()
B.GValue.set_boxed Ptr GValue
gv (Ptr Sphere
forall a. Ptr a
FP.nullPtr :: FP.Ptr Sphere)
    gvalueSet_ Ptr GValue
gv (P.Just Sphere
obj) = Sphere -> (Ptr Sphere -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr Sphere
obj (Ptr GValue -> Ptr Sphere -> IO ()
forall a. Ptr GValue -> Ptr a -> IO ()
B.GValue.set_boxed Ptr GValue
gv)
    gvalueGet_ :: Ptr GValue -> IO (Maybe Sphere)
gvalueGet_ Ptr GValue
gv = do
        ptr <- Ptr GValue -> IO (Ptr Sphere)
forall b. Ptr GValue -> IO (Ptr b)
B.GValue.get_boxed Ptr GValue
gv :: IO (Ptr Sphere)
        if ptr /= FP.nullPtr
        then P.Just <$> B.ManagedPtr.newBoxed Sphere ptr
        else return P.Nothing
        
    

-- | Construct a t'Sphere' struct initialized to zero.
newZeroSphere :: MonadIO m => m Sphere
newZeroSphere :: forall (m :: * -> *). MonadIO m => m Sphere
newZeroSphere = IO Sphere -> m Sphere
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Sphere -> m Sphere) -> IO Sphere -> m Sphere
forall a b. (a -> b) -> a -> b
$ Int -> IO (Ptr Sphere)
forall a. GBoxed a => Int -> IO (Ptr a)
callocBoxedBytes Int
20 IO (Ptr Sphere) -> (Ptr Sphere -> IO Sphere) -> IO Sphere
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= (ManagedPtr Sphere -> Sphere) -> Ptr Sphere -> IO Sphere
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Sphere -> Sphere
Sphere

instance tag ~ 'AttrSet => Constructible Sphere tag where
    new :: forall (m :: * -> *).
MonadIO m =>
(ManagedPtr Sphere -> Sphere) -> [AttrOp Sphere tag] -> m Sphere
new ManagedPtr Sphere -> Sphere
_ [AttrOp Sphere tag]
attrs = do
        o <- m Sphere
forall (m :: * -> *). MonadIO m => m Sphere
newZeroSphere
        GI.Attributes.set o attrs
        return o



#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList Sphere
type instance O.AttributeList Sphere = SphereAttributeList
type SphereAttributeList = ('[ ] :: [(Symbol, DK.Type)])
#endif

-- method Sphere::alloc
-- method type : Constructor
-- Args: []
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Graphene" , name = "Sphere" })
-- throws : False
-- Skip return : False

foreign import ccall "graphene_sphere_alloc" graphene_sphere_alloc :: 
    IO (Ptr Sphere)

-- | Allocates a new t'GI.Graphene.Structs.Sphere.Sphere'.
-- 
-- The contents of the newly allocated structure are undefined.
-- 
-- /Since: 1.2/
sphereAlloc ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m Sphere
    -- ^ __Returns:__ the newly allocated t'GI.Graphene.Structs.Sphere.Sphere'. Use
    --   'GI.Graphene.Structs.Sphere.sphereFree' to free the resources allocated by this function
sphereAlloc :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m Sphere
sphereAlloc  = IO Sphere -> m Sphere
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Sphere -> m Sphere) -> IO Sphere -> m Sphere
forall a b. (a -> b) -> a -> b
$ do
    result <- IO (Ptr Sphere)
graphene_sphere_alloc
    checkUnexpectedReturnNULL "sphereAlloc" result
    result' <- (wrapBoxed Sphere) result
    return result'

#if defined(ENABLE_OVERLOADING)
#endif

-- method Sphere::contains_point
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "s"
--           , argType =
--               TInterface Name { namespace = "Graphene" , name = "Sphere" }
--           , argCType = Just "const graphene_sphere_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #graphene_sphere_t"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "point"
--           , argType =
--               TInterface Name { namespace = "Graphene" , name = "Point3D" }
--           , argCType = Just "const graphene_point3d_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #graphene_point3d_t"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "graphene_sphere_contains_point" graphene_sphere_contains_point :: 
    Ptr Sphere ->                           -- s : TInterface (Name {namespace = "Graphene", name = "Sphere"})
    Ptr Graphene.Point3D.Point3D ->         -- point : TInterface (Name {namespace = "Graphene", name = "Point3D"})
    IO CInt

-- | Checks whether the given /@point@/ is contained in the volume
-- of a t'GI.Graphene.Structs.Sphere.Sphere'.
-- 
-- /Since: 1.2/
sphereContainsPoint ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Sphere
    -- ^ /@s@/: a t'GI.Graphene.Structs.Sphere.Sphere'
    -> Graphene.Point3D.Point3D
    -- ^ /@point@/: a t'GI.Graphene.Structs.Point3D.Point3D'
    -> m Bool
    -- ^ __Returns:__ @true@ if the sphere contains the point
sphereContainsPoint :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Sphere -> Point3D -> m Bool
sphereContainsPoint Sphere
s Point3D
point = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
    s' <- Sphere -> IO (Ptr Sphere)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Sphere
s
    point' <- unsafeManagedPtrGetPtr point
    result <- graphene_sphere_contains_point s' point'
    let result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    touchManagedPtr s
    touchManagedPtr point
    return result'

#if defined(ENABLE_OVERLOADING)
data SphereContainsPointMethodInfo
instance (signature ~ (Graphene.Point3D.Point3D -> m Bool), MonadIO m) => O.OverloadedMethod SphereContainsPointMethodInfo Sphere signature where
    overloadedMethod = sphereContainsPoint

instance O.OverloadedMethodInfo SphereContainsPointMethodInfo Sphere where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Graphene.Structs.Sphere.sphereContainsPoint",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-graphene-1.0.8/docs/GI-Graphene-Structs-Sphere.html#v:sphereContainsPoint"
        })


#endif

-- method Sphere::distance
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "s"
--           , argType =
--               TInterface Name { namespace = "Graphene" , name = "Sphere" }
--           , argCType = Just "const graphene_sphere_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #graphene_sphere_t"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "point"
--           , argType =
--               TInterface Name { namespace = "Graphene" , name = "Point3D" }
--           , argCType = Just "const graphene_point3d_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #graphene_point3d_t"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TFloat)
-- throws : False
-- Skip return : False

foreign import ccall "graphene_sphere_distance" graphene_sphere_distance :: 
    Ptr Sphere ->                           -- s : TInterface (Name {namespace = "Graphene", name = "Sphere"})
    Ptr Graphene.Point3D.Point3D ->         -- point : TInterface (Name {namespace = "Graphene", name = "Point3D"})
    IO CFloat

-- | Computes the distance of the given /@point@/ from the surface of
-- a t'GI.Graphene.Structs.Sphere.Sphere'.
-- 
-- /Since: 1.2/
sphereDistance ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Sphere
    -- ^ /@s@/: a t'GI.Graphene.Structs.Sphere.Sphere'
    -> Graphene.Point3D.Point3D
    -- ^ /@point@/: a t'GI.Graphene.Structs.Point3D.Point3D'
    -> m Float
    -- ^ __Returns:__ the distance of the point
sphereDistance :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Sphere -> Point3D -> m Float
sphereDistance Sphere
s Point3D
point = IO Float -> m Float
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Float -> m Float) -> IO Float -> m Float
forall a b. (a -> b) -> a -> b
$ do
    s' <- Sphere -> IO (Ptr Sphere)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Sphere
s
    point' <- unsafeManagedPtrGetPtr point
    result <- graphene_sphere_distance s' point'
    let result' = CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac CFloat
result
    touchManagedPtr s
    touchManagedPtr point
    return result'

#if defined(ENABLE_OVERLOADING)
data SphereDistanceMethodInfo
instance (signature ~ (Graphene.Point3D.Point3D -> m Float), MonadIO m) => O.OverloadedMethod SphereDistanceMethodInfo Sphere signature where
    overloadedMethod = sphereDistance

instance O.OverloadedMethodInfo SphereDistanceMethodInfo Sphere where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Graphene.Structs.Sphere.sphereDistance",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-graphene-1.0.8/docs/GI-Graphene-Structs-Sphere.html#v:sphereDistance"
        })


#endif

-- method Sphere::equal
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "a"
--           , argType =
--               TInterface Name { namespace = "Graphene" , name = "Sphere" }
--           , argCType = Just "const graphene_sphere_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #graphene_sphere_t"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "b"
--           , argType =
--               TInterface Name { namespace = "Graphene" , name = "Sphere" }
--           , argCType = Just "const graphene_sphere_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #graphene_sphere_t"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "graphene_sphere_equal" graphene_sphere_equal :: 
    Ptr Sphere ->                           -- a : TInterface (Name {namespace = "Graphene", name = "Sphere"})
    Ptr Sphere ->                           -- b : TInterface (Name {namespace = "Graphene", name = "Sphere"})
    IO CInt

-- | Checks whether two t'GI.Graphene.Structs.Sphere.Sphere' are equal.
-- 
-- /Since: 1.2/
sphereEqual ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Sphere
    -- ^ /@a@/: a t'GI.Graphene.Structs.Sphere.Sphere'
    -> Sphere
    -- ^ /@b@/: a t'GI.Graphene.Structs.Sphere.Sphere'
    -> m Bool
    -- ^ __Returns:__ @true@ if the spheres are equal
sphereEqual :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Sphere -> Sphere -> m Bool
sphereEqual Sphere
a Sphere
b = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
    a' <- Sphere -> IO (Ptr Sphere)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Sphere
a
    b' <- unsafeManagedPtrGetPtr b
    result <- graphene_sphere_equal a' b'
    let result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    touchManagedPtr a
    touchManagedPtr b
    return result'

#if defined(ENABLE_OVERLOADING)
data SphereEqualMethodInfo
instance (signature ~ (Sphere -> m Bool), MonadIO m) => O.OverloadedMethod SphereEqualMethodInfo Sphere signature where
    overloadedMethod = sphereEqual

instance O.OverloadedMethodInfo SphereEqualMethodInfo Sphere where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Graphene.Structs.Sphere.sphereEqual",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-graphene-1.0.8/docs/GI-Graphene-Structs-Sphere.html#v:sphereEqual"
        })


#endif

-- method Sphere::free
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "s"
--           , argType =
--               TInterface Name { namespace = "Graphene" , name = "Sphere" }
--           , argCType = Just "graphene_sphere_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #graphene_sphere_t"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "graphene_sphere_free" graphene_sphere_free :: 
    Ptr Sphere ->                           -- s : TInterface (Name {namespace = "Graphene", name = "Sphere"})
    IO ()

-- | Frees the resources allocated by 'GI.Graphene.Structs.Sphere.sphereAlloc'.
-- 
-- /Since: 1.2/
sphereFree ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Sphere
    -- ^ /@s@/: a t'GI.Graphene.Structs.Sphere.Sphere'
    -> m ()
sphereFree :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Sphere -> m ()
sphereFree Sphere
s = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    s' <- Sphere -> IO (Ptr Sphere)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Sphere
s
    graphene_sphere_free s'
    touchManagedPtr s
    return ()

#if defined(ENABLE_OVERLOADING)
data SphereFreeMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.OverloadedMethod SphereFreeMethodInfo Sphere signature where
    overloadedMethod = sphereFree

instance O.OverloadedMethodInfo SphereFreeMethodInfo Sphere where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Graphene.Structs.Sphere.sphereFree",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-graphene-1.0.8/docs/GI-Graphene-Structs-Sphere.html#v:sphereFree"
        })


#endif

-- method Sphere::get_bounding_box
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "s"
--           , argType =
--               TInterface Name { namespace = "Graphene" , name = "Sphere" }
--           , argCType = Just "const graphene_sphere_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #graphene_sphere_t"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "box"
--           , argType =
--               TInterface Name { namespace = "Graphene" , name = "Box" }
--           , argCType = Just "graphene_box_t*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "return location for the bounding box"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = True
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "graphene_sphere_get_bounding_box" graphene_sphere_get_bounding_box :: 
    Ptr Sphere ->                           -- s : TInterface (Name {namespace = "Graphene", name = "Sphere"})
    Ptr Graphene.Box.Box ->                 -- box : TInterface (Name {namespace = "Graphene", name = "Box"})
    IO ()

-- | Computes the bounding box capable of containing the
-- given t'GI.Graphene.Structs.Sphere.Sphere'.
-- 
-- /Since: 1.2/
sphereGetBoundingBox ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Sphere
    -- ^ /@s@/: a t'GI.Graphene.Structs.Sphere.Sphere'
    -> m (Graphene.Box.Box)
sphereGetBoundingBox :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Sphere -> m Box
sphereGetBoundingBox Sphere
s = IO Box -> m Box
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Box -> m Box) -> IO Box -> m Box
forall a b. (a -> b) -> a -> b
$ do
    s' <- Sphere -> IO (Ptr Sphere)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Sphere
s
    box <- SP.callocBoxedBytes 32 :: IO (Ptr Graphene.Box.Box)
    graphene_sphere_get_bounding_box s' box
    box' <- (wrapBoxed Graphene.Box.Box) box
    touchManagedPtr s
    return box'

#if defined(ENABLE_OVERLOADING)
data SphereGetBoundingBoxMethodInfo
instance (signature ~ (m (Graphene.Box.Box)), MonadIO m) => O.OverloadedMethod SphereGetBoundingBoxMethodInfo Sphere signature where
    overloadedMethod = sphereGetBoundingBox

instance O.OverloadedMethodInfo SphereGetBoundingBoxMethodInfo Sphere where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Graphene.Structs.Sphere.sphereGetBoundingBox",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-graphene-1.0.8/docs/GI-Graphene-Structs-Sphere.html#v:sphereGetBoundingBox"
        })


#endif

-- method Sphere::get_center
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "s"
--           , argType =
--               TInterface Name { namespace = "Graphene" , name = "Sphere" }
--           , argCType = Just "const graphene_sphere_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #graphene_sphere_t"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "center"
--           , argType =
--               TInterface Name { namespace = "Graphene" , name = "Point3D" }
--           , argCType = Just "graphene_point3d_t*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "return location for the coordinates of\n  the center"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = True
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "graphene_sphere_get_center" graphene_sphere_get_center :: 
    Ptr Sphere ->                           -- s : TInterface (Name {namespace = "Graphene", name = "Sphere"})
    Ptr Graphene.Point3D.Point3D ->         -- center : TInterface (Name {namespace = "Graphene", name = "Point3D"})
    IO ()

-- | Retrieves the coordinates of the center of a t'GI.Graphene.Structs.Sphere.Sphere'.
-- 
-- /Since: 1.2/
sphereGetCenter ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Sphere
    -- ^ /@s@/: a t'GI.Graphene.Structs.Sphere.Sphere'
    -> m (Graphene.Point3D.Point3D)
sphereGetCenter :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Sphere -> m Point3D
sphereGetCenter Sphere
s = IO Point3D -> m Point3D
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Point3D -> m Point3D) -> IO Point3D -> m Point3D
forall a b. (a -> b) -> a -> b
$ do
    s' <- Sphere -> IO (Ptr Sphere)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Sphere
s
    center <- SP.callocBoxedBytes 12 :: IO (Ptr Graphene.Point3D.Point3D)
    graphene_sphere_get_center s' center
    center' <- (wrapBoxed Graphene.Point3D.Point3D) center
    touchManagedPtr s
    return center'

#if defined(ENABLE_OVERLOADING)
data SphereGetCenterMethodInfo
instance (signature ~ (m (Graphene.Point3D.Point3D)), MonadIO m) => O.OverloadedMethod SphereGetCenterMethodInfo Sphere signature where
    overloadedMethod = sphereGetCenter

instance O.OverloadedMethodInfo SphereGetCenterMethodInfo Sphere where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Graphene.Structs.Sphere.sphereGetCenter",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-graphene-1.0.8/docs/GI-Graphene-Structs-Sphere.html#v:sphereGetCenter"
        })


#endif

-- method Sphere::get_radius
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "s"
--           , argType =
--               TInterface Name { namespace = "Graphene" , name = "Sphere" }
--           , argCType = Just "const graphene_sphere_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #graphene_sphere_t"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TFloat)
-- throws : False
-- Skip return : False

foreign import ccall "graphene_sphere_get_radius" graphene_sphere_get_radius :: 
    Ptr Sphere ->                           -- s : TInterface (Name {namespace = "Graphene", name = "Sphere"})
    IO CFloat

-- | Retrieves the radius of a t'GI.Graphene.Structs.Sphere.Sphere'.
-- 
-- /Since: 1.2/
sphereGetRadius ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Sphere
    -- ^ /@s@/: a t'GI.Graphene.Structs.Sphere.Sphere'
    -> m Float
sphereGetRadius :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Sphere -> m Float
sphereGetRadius Sphere
s = IO Float -> m Float
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Float -> m Float) -> IO Float -> m Float
forall a b. (a -> b) -> a -> b
$ do
    s' <- Sphere -> IO (Ptr Sphere)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Sphere
s
    result <- graphene_sphere_get_radius s'
    let result' = CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac CFloat
result
    touchManagedPtr s
    return result'

#if defined(ENABLE_OVERLOADING)
data SphereGetRadiusMethodInfo
instance (signature ~ (m Float), MonadIO m) => O.OverloadedMethod SphereGetRadiusMethodInfo Sphere signature where
    overloadedMethod = sphereGetRadius

instance O.OverloadedMethodInfo SphereGetRadiusMethodInfo Sphere where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Graphene.Structs.Sphere.sphereGetRadius",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-graphene-1.0.8/docs/GI-Graphene-Structs-Sphere.html#v:sphereGetRadius"
        })


#endif

-- method Sphere::init
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "s"
--           , argType =
--               TInterface Name { namespace = "Graphene" , name = "Sphere" }
--           , argCType = Just "graphene_sphere_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the #graphene_sphere_t to initialize"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "center"
--           , argType =
--               TInterface Name { namespace = "Graphene" , name = "Point3D" }
--           , argCType = Just "const graphene_point3d_t*"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "the coordinates of the center of the sphere, or %NULL\n  for a center in (0, 0, 0)"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "radius"
--           , argType = TBasicType TFloat
--           , argCType = Just "float"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the radius of the sphere"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Graphene" , name = "Sphere" })
-- throws : False
-- Skip return : False

foreign import ccall "graphene_sphere_init" graphene_sphere_init :: 
    Ptr Sphere ->                           -- s : TInterface (Name {namespace = "Graphene", name = "Sphere"})
    Ptr Graphene.Point3D.Point3D ->         -- center : TInterface (Name {namespace = "Graphene", name = "Point3D"})
    CFloat ->                               -- radius : TBasicType TFloat
    IO (Ptr Sphere)

-- | Initializes the given t'GI.Graphene.Structs.Sphere.Sphere' with the given /@center@/ and /@radius@/.
-- 
-- /Since: 1.2/
sphereInit ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Sphere
    -- ^ /@s@/: the t'GI.Graphene.Structs.Sphere.Sphere' to initialize
    -> Maybe (Graphene.Point3D.Point3D)
    -- ^ /@center@/: the coordinates of the center of the sphere, or 'P.Nothing'
    --   for a center in (0, 0, 0)
    -> Float
    -- ^ /@radius@/: the radius of the sphere
    -> m Sphere
    -- ^ __Returns:__ the initialized t'GI.Graphene.Structs.Sphere.Sphere'
sphereInit :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Sphere -> Maybe Point3D -> Float -> m Sphere
sphereInit Sphere
s Maybe Point3D
center Float
radius = IO Sphere -> m Sphere
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Sphere -> m Sphere) -> IO Sphere -> m Sphere
forall a b. (a -> b) -> a -> b
$ do
    s' <- Sphere -> IO (Ptr Sphere)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Sphere
s
    maybeCenter <- case center of
        Maybe Point3D
Nothing -> Ptr Point3D -> IO (Ptr Point3D)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Point3D
forall a. Ptr a
FP.nullPtr
        Just Point3D
jCenter -> do
            jCenter' <- Point3D -> IO (Ptr Point3D)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Point3D
jCenter
            return jCenter'
    let radius' = Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
radius
    result <- graphene_sphere_init s' maybeCenter radius'
    checkUnexpectedReturnNULL "sphereInit" result
    result' <- (newBoxed Sphere) result
    touchManagedPtr s
    whenJust center touchManagedPtr
    return result'

#if defined(ENABLE_OVERLOADING)
data SphereInitMethodInfo
instance (signature ~ (Maybe (Graphene.Point3D.Point3D) -> Float -> m Sphere), MonadIO m) => O.OverloadedMethod SphereInitMethodInfo Sphere signature where
    overloadedMethod = sphereInit

instance O.OverloadedMethodInfo SphereInitMethodInfo Sphere where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Graphene.Structs.Sphere.sphereInit",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-graphene-1.0.8/docs/GI-Graphene-Structs-Sphere.html#v:sphereInit"
        })


#endif

-- method Sphere::init_from_points
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "s"
--           , argType =
--               TInterface Name { namespace = "Graphene" , name = "Sphere" }
--           , argCType = Just "graphene_sphere_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the #graphene_sphere_t to initialize"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "n_points"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "the number of #graphene_point3d_t in the @points array"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "points"
--           , argType =
--               TCArray
--                 False
--                 (-1)
--                 1
--                 (TInterface Name { namespace = "Graphene" , name = "Point3D" })
--           , argCType = Just "const graphene_point3d_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "an array of #graphene_point3d_t"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "center"
--           , argType =
--               TInterface Name { namespace = "Graphene" , name = "Point3D" }
--           , argCType = Just "const graphene_point3d_t*"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the center of the sphere"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "n_points"
--              , argType = TBasicType TUInt
--              , argCType = Just "unsigned int"
--              , direction = DirectionIn
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText =
--                        Just "the number of #graphene_point3d_t in the @points array"
--                    , sinceVersion = Nothing
--                    }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , argCallbackUserData = False
--              , transfer = TransferNothing
--              }
--          ]
-- returnType: Just (TInterface Name { namespace = "Graphene" , name = "Sphere" })
-- throws : False
-- Skip return : False

foreign import ccall "graphene_sphere_init_from_points" graphene_sphere_init_from_points :: 
    Ptr Sphere ->                           -- s : TInterface (Name {namespace = "Graphene", name = "Sphere"})
    Word32 ->                               -- n_points : TBasicType TUInt
    Ptr Graphene.Point3D.Point3D ->         -- points : TCArray False (-1) 1 (TInterface (Name {namespace = "Graphene", name = "Point3D"}))
    Ptr Graphene.Point3D.Point3D ->         -- center : TInterface (Name {namespace = "Graphene", name = "Point3D"})
    IO (Ptr Sphere)

-- | Initializes the given t'GI.Graphene.Structs.Sphere.Sphere' using the given array
-- of 3D coordinates so that the sphere includes them.
-- 
-- The center of the sphere can either be specified, or will be center
-- of the 3D volume that encompasses all /@points@/.
-- 
-- /Since: 1.2/
sphereInitFromPoints ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Sphere
    -- ^ /@s@/: the t'GI.Graphene.Structs.Sphere.Sphere' to initialize
    -> [Graphene.Point3D.Point3D]
    -- ^ /@points@/: an array of t'GI.Graphene.Structs.Point3D.Point3D'
    -> Maybe (Graphene.Point3D.Point3D)
    -- ^ /@center@/: the center of the sphere
    -> m Sphere
    -- ^ __Returns:__ the initialized t'GI.Graphene.Structs.Sphere.Sphere'
sphereInitFromPoints :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Sphere -> [Point3D] -> Maybe Point3D -> m Sphere
sphereInitFromPoints Sphere
s [Point3D]
points Maybe Point3D
center = IO Sphere -> m Sphere
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Sphere -> m Sphere) -> IO Sphere -> m Sphere
forall a b. (a -> b) -> a -> b
$ do
    let nPoints :: Word32
nPoints = Int -> Word32
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> Word32) -> Int -> Word32
forall a b. (a -> b) -> a -> b
$ [Point3D] -> Int
forall a. [a] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
P.length [Point3D]
points
    s' <- Sphere -> IO (Ptr Sphere)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Sphere
s
    points' <- mapM unsafeManagedPtrGetPtr points
    points'' <- packBlockArray 12 points'
    maybeCenter <- case center of
        Maybe Point3D
Nothing -> Ptr Point3D -> IO (Ptr Point3D)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Point3D
forall a. Ptr a
FP.nullPtr
        Just Point3D
jCenter -> do
            jCenter' <- Point3D -> IO (Ptr Point3D)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Point3D
jCenter
            return jCenter'
    result <- graphene_sphere_init_from_points s' nPoints points'' maybeCenter
    checkUnexpectedReturnNULL "sphereInitFromPoints" result
    result' <- (newBoxed Sphere) result
    touchManagedPtr s
    mapM_ touchManagedPtr points
    whenJust center touchManagedPtr
    freeMem points''
    return result'

#if defined(ENABLE_OVERLOADING)
data SphereInitFromPointsMethodInfo
instance (signature ~ ([Graphene.Point3D.Point3D] -> Maybe (Graphene.Point3D.Point3D) -> m Sphere), MonadIO m) => O.OverloadedMethod SphereInitFromPointsMethodInfo Sphere signature where
    overloadedMethod = sphereInitFromPoints

instance O.OverloadedMethodInfo SphereInitFromPointsMethodInfo Sphere where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Graphene.Structs.Sphere.sphereInitFromPoints",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-graphene-1.0.8/docs/GI-Graphene-Structs-Sphere.html#v:sphereInitFromPoints"
        })


#endif

-- method Sphere::init_from_vectors
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "s"
--           , argType =
--               TInterface Name { namespace = "Graphene" , name = "Sphere" }
--           , argCType = Just "graphene_sphere_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the #graphene_sphere_t to initialize"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "n_vectors"
--           , argType = TBasicType TUInt
--           , argCType = Just "unsigned int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "the number of #graphene_vec3_t in the @vectors array"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "vectors"
--           , argType =
--               TCArray
--                 False
--                 (-1)
--                 1
--                 (TInterface Name { namespace = "Graphene" , name = "Vec3" })
--           , argCType = Just "const graphene_vec3_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "an array of #graphene_vec3_t"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "center"
--           , argType =
--               TInterface Name { namespace = "Graphene" , name = "Point3D" }
--           , argCType = Just "const graphene_point3d_t*"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the center of the sphere"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "n_vectors"
--              , argType = TBasicType TUInt
--              , argCType = Just "unsigned int"
--              , direction = DirectionIn
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText =
--                        Just "the number of #graphene_vec3_t in the @vectors array"
--                    , sinceVersion = Nothing
--                    }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , argCallbackUserData = False
--              , transfer = TransferNothing
--              }
--          ]
-- returnType: Just (TInterface Name { namespace = "Graphene" , name = "Sphere" })
-- throws : False
-- Skip return : False

foreign import ccall "graphene_sphere_init_from_vectors" graphene_sphere_init_from_vectors :: 
    Ptr Sphere ->                           -- s : TInterface (Name {namespace = "Graphene", name = "Sphere"})
    Word32 ->                               -- n_vectors : TBasicType TUInt
    Ptr Graphene.Vec3.Vec3 ->               -- vectors : TCArray False (-1) 1 (TInterface (Name {namespace = "Graphene", name = "Vec3"}))
    Ptr Graphene.Point3D.Point3D ->         -- center : TInterface (Name {namespace = "Graphene", name = "Point3D"})
    IO (Ptr Sphere)

-- | Initializes the given t'GI.Graphene.Structs.Sphere.Sphere' using the given array
-- of 3D coordinates so that the sphere includes them.
-- 
-- The center of the sphere can either be specified, or will be center
-- of the 3D volume that encompasses all /@vectors@/.
-- 
-- /Since: 1.2/
sphereInitFromVectors ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Sphere
    -- ^ /@s@/: the t'GI.Graphene.Structs.Sphere.Sphere' to initialize
    -> [Graphene.Vec3.Vec3]
    -- ^ /@vectors@/: an array of t'GI.Graphene.Structs.Vec3.Vec3'
    -> Maybe (Graphene.Point3D.Point3D)
    -- ^ /@center@/: the center of the sphere
    -> m Sphere
    -- ^ __Returns:__ the initialized t'GI.Graphene.Structs.Sphere.Sphere'
sphereInitFromVectors :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Sphere -> [Vec3] -> Maybe Point3D -> m Sphere
sphereInitFromVectors Sphere
s [Vec3]
vectors Maybe Point3D
center = IO Sphere -> m Sphere
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Sphere -> m Sphere) -> IO Sphere -> m Sphere
forall a b. (a -> b) -> a -> b
$ do
    let nVectors :: Word32
nVectors = Int -> Word32
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> Word32) -> Int -> Word32
forall a b. (a -> b) -> a -> b
$ [Vec3] -> Int
forall a. [a] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
P.length [Vec3]
vectors
    s' <- Sphere -> IO (Ptr Sphere)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Sphere
s
    vectors' <- mapM unsafeManagedPtrGetPtr vectors
    vectors'' <- packBlockArray 16 vectors'
    maybeCenter <- case center of
        Maybe Point3D
Nothing -> Ptr Point3D -> IO (Ptr Point3D)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Point3D
forall a. Ptr a
FP.nullPtr
        Just Point3D
jCenter -> do
            jCenter' <- Point3D -> IO (Ptr Point3D)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Point3D
jCenter
            return jCenter'
    result <- graphene_sphere_init_from_vectors s' nVectors vectors'' maybeCenter
    checkUnexpectedReturnNULL "sphereInitFromVectors" result
    result' <- (newBoxed Sphere) result
    touchManagedPtr s
    mapM_ touchManagedPtr vectors
    whenJust center touchManagedPtr
    freeMem vectors''
    return result'

#if defined(ENABLE_OVERLOADING)
data SphereInitFromVectorsMethodInfo
instance (signature ~ ([Graphene.Vec3.Vec3] -> Maybe (Graphene.Point3D.Point3D) -> m Sphere), MonadIO m) => O.OverloadedMethod SphereInitFromVectorsMethodInfo Sphere signature where
    overloadedMethod = sphereInitFromVectors

instance O.OverloadedMethodInfo SphereInitFromVectorsMethodInfo Sphere where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Graphene.Structs.Sphere.sphereInitFromVectors",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-graphene-1.0.8/docs/GI-Graphene-Structs-Sphere.html#v:sphereInitFromVectors"
        })


#endif

-- method Sphere::is_empty
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "s"
--           , argType =
--               TInterface Name { namespace = "Graphene" , name = "Sphere" }
--           , argCType = Just "const graphene_sphere_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #graphene_sphere_t"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "graphene_sphere_is_empty" graphene_sphere_is_empty :: 
    Ptr Sphere ->                           -- s : TInterface (Name {namespace = "Graphene", name = "Sphere"})
    IO CInt

-- | Checks whether the sphere has a zero radius.
-- 
-- /Since: 1.2/
sphereIsEmpty ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Sphere
    -- ^ /@s@/: a t'GI.Graphene.Structs.Sphere.Sphere'
    -> m Bool
    -- ^ __Returns:__ @true@ if the sphere is empty
sphereIsEmpty :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Sphere -> m Bool
sphereIsEmpty Sphere
s = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
    s' <- Sphere -> IO (Ptr Sphere)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Sphere
s
    result <- graphene_sphere_is_empty s'
    let result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    touchManagedPtr s
    return result'

#if defined(ENABLE_OVERLOADING)
data SphereIsEmptyMethodInfo
instance (signature ~ (m Bool), MonadIO m) => O.OverloadedMethod SphereIsEmptyMethodInfo Sphere signature where
    overloadedMethod = sphereIsEmpty

instance O.OverloadedMethodInfo SphereIsEmptyMethodInfo Sphere where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Graphene.Structs.Sphere.sphereIsEmpty",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-graphene-1.0.8/docs/GI-Graphene-Structs-Sphere.html#v:sphereIsEmpty"
        })


#endif

-- method Sphere::translate
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "s"
--           , argType =
--               TInterface Name { namespace = "Graphene" , name = "Sphere" }
--           , argCType = Just "const graphene_sphere_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #graphene_sphere_t"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "point"
--           , argType =
--               TInterface Name { namespace = "Graphene" , name = "Point3D" }
--           , argCType = Just "const graphene_point3d_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the coordinates of the translation"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "res"
--           , argType =
--               TInterface Name { namespace = "Graphene" , name = "Sphere" }
--           , argCType = Just "graphene_sphere_t*"
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "return location for the translated sphere"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = True
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "graphene_sphere_translate" graphene_sphere_translate :: 
    Ptr Sphere ->                           -- s : TInterface (Name {namespace = "Graphene", name = "Sphere"})
    Ptr Graphene.Point3D.Point3D ->         -- point : TInterface (Name {namespace = "Graphene", name = "Point3D"})
    Ptr Sphere ->                           -- res : TInterface (Name {namespace = "Graphene", name = "Sphere"})
    IO ()

-- | Translates the center of the given t'GI.Graphene.Structs.Sphere.Sphere' using the /@point@/
-- coordinates as the delta of the translation.
-- 
-- /Since: 1.2/
sphereTranslate ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Sphere
    -- ^ /@s@/: a t'GI.Graphene.Structs.Sphere.Sphere'
    -> Graphene.Point3D.Point3D
    -- ^ /@point@/: the coordinates of the translation
    -> m (Sphere)
sphereTranslate :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Sphere -> Point3D -> m Sphere
sphereTranslate Sphere
s Point3D
point = IO Sphere -> m Sphere
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Sphere -> m Sphere) -> IO Sphere -> m Sphere
forall a b. (a -> b) -> a -> b
$ do
    s' <- Sphere -> IO (Ptr Sphere)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Sphere
s
    point' <- unsafeManagedPtrGetPtr point
    res <- SP.callocBoxedBytes 20 :: IO (Ptr Sphere)
    graphene_sphere_translate s' point' res
    res' <- (wrapBoxed Sphere) res
    touchManagedPtr s
    touchManagedPtr point
    return res'

#if defined(ENABLE_OVERLOADING)
data SphereTranslateMethodInfo
instance (signature ~ (Graphene.Point3D.Point3D -> m (Sphere)), MonadIO m) => O.OverloadedMethod SphereTranslateMethodInfo Sphere signature where
    overloadedMethod = sphereTranslate

instance O.OverloadedMethodInfo SphereTranslateMethodInfo Sphere where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Graphene.Structs.Sphere.sphereTranslate",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-graphene-1.0.8/docs/GI-Graphene-Structs-Sphere.html#v:sphereTranslate"
        })


#endif

#if defined(ENABLE_OVERLOADING)
type family ResolveSphereMethod (t :: Symbol) (o :: DK.Type) :: DK.Type where
    ResolveSphereMethod "containsPoint" o = SphereContainsPointMethodInfo
    ResolveSphereMethod "distance" o = SphereDistanceMethodInfo
    ResolveSphereMethod "equal" o = SphereEqualMethodInfo
    ResolveSphereMethod "free" o = SphereFreeMethodInfo
    ResolveSphereMethod "init" o = SphereInitMethodInfo
    ResolveSphereMethod "initFromPoints" o = SphereInitFromPointsMethodInfo
    ResolveSphereMethod "initFromVectors" o = SphereInitFromVectorsMethodInfo
    ResolveSphereMethod "isEmpty" o = SphereIsEmptyMethodInfo
    ResolveSphereMethod "translate" o = SphereTranslateMethodInfo
    ResolveSphereMethod "getBoundingBox" o = SphereGetBoundingBoxMethodInfo
    ResolveSphereMethod "getCenter" o = SphereGetCenterMethodInfo
    ResolveSphereMethod "getRadius" o = SphereGetRadiusMethodInfo
    ResolveSphereMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveSphereMethod t Sphere, O.OverloadedMethod info Sphere p) => OL.IsLabel t (Sphere -> p) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.overloadedMethod @info
#else
    fromLabel _ = O.overloadedMethod @info
#endif

#if MIN_VERSION_base(4,13,0)
instance (info ~ ResolveSphereMethod t Sphere, O.OverloadedMethod info Sphere p, R.HasField t Sphere p) => R.HasField t Sphere p where
    getField = O.overloadedMethod @info

#endif

instance (info ~ ResolveSphereMethod t Sphere, O.OverloadedMethodInfo info Sphere) => OL.IsLabel t (O.MethodProxy info Sphere) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.MethodProxy
#else
    fromLabel _ = O.MethodProxy
#endif

#endif