{-# LANGUAGE TypeApplications #-}


-- | Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria
-- 
-- A 2D plane that extends infinitely in a 3D volume.
-- 
-- The contents of the @graphene_plane_t@ are private, and should not be
-- modified directly.
-- 
-- /Since: 1.2/

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

module GI.Graphene.Structs.Plane
    ( 

-- * Exported types
    Plane(..)                               ,
    newZeroPlane                            ,
    noPlane                                 ,


 -- * Methods
-- ** Overloaded methods #method:Overloaded methods#

#if defined(ENABLE_OVERLOADING)
    ResolvePlaneMethod                      ,
#endif


-- ** alloc #method:alloc#

    planeAlloc                              ,


-- ** distance #method:distance#

#if defined(ENABLE_OVERLOADING)
    PlaneDistanceMethodInfo                 ,
#endif
    planeDistance                           ,


-- ** equal #method:equal#

#if defined(ENABLE_OVERLOADING)
    PlaneEqualMethodInfo                    ,
#endif
    planeEqual                              ,


-- ** free #method:free#

#if defined(ENABLE_OVERLOADING)
    PlaneFreeMethodInfo                     ,
#endif
    planeFree                               ,


-- ** getConstant #method:getConstant#

#if defined(ENABLE_OVERLOADING)
    PlaneGetConstantMethodInfo              ,
#endif
    planeGetConstant                        ,


-- ** getNormal #method:getNormal#

#if defined(ENABLE_OVERLOADING)
    PlaneGetNormalMethodInfo                ,
#endif
    planeGetNormal                          ,


-- ** init #method:init#

#if defined(ENABLE_OVERLOADING)
    PlaneInitMethodInfo                     ,
#endif
    planeInit                               ,


-- ** initFromPlane #method:initFromPlane#

#if defined(ENABLE_OVERLOADING)
    PlaneInitFromPlaneMethodInfo            ,
#endif
    planeInitFromPlane                      ,


-- ** initFromPoint #method:initFromPoint#

#if defined(ENABLE_OVERLOADING)
    PlaneInitFromPointMethodInfo            ,
#endif
    planeInitFromPoint                      ,


-- ** initFromPoints #method:initFromPoints#

#if defined(ENABLE_OVERLOADING)
    PlaneInitFromPointsMethodInfo           ,
#endif
    planeInitFromPoints                     ,


-- ** initFromVec4 #method:initFromVec4#

#if defined(ENABLE_OVERLOADING)
    PlaneInitFromVec4MethodInfo             ,
#endif
    planeInitFromVec4                       ,


-- ** negate #method:negate#

#if defined(ENABLE_OVERLOADING)
    PlaneNegateMethodInfo                   ,
#endif
    planeNegate                             ,


-- ** normalize #method:normalize#

#if defined(ENABLE_OVERLOADING)
    PlaneNormalizeMethodInfo                ,
#endif
    planeNormalize                          ,




    ) 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.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
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 Data.Text as T
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 {-# SOURCE #-} qualified GI.Graphene.Structs.Point3D as Graphene.Point3D
import {-# SOURCE #-} qualified GI.Graphene.Structs.Vec3 as Graphene.Vec3
import {-# SOURCE #-} qualified GI.Graphene.Structs.Vec4 as Graphene.Vec4

-- | Memory-managed wrapper type.
newtype Plane = Plane (ManagedPtr Plane)
    deriving (Plane -> Plane -> Bool
(Plane -> Plane -> Bool) -> (Plane -> Plane -> Bool) -> Eq Plane
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Plane -> Plane -> Bool
$c/= :: Plane -> Plane -> Bool
== :: Plane -> Plane -> Bool
$c== :: Plane -> Plane -> Bool
Eq)
foreign import ccall "graphene_plane_get_type" c_graphene_plane_get_type :: 
    IO GType

instance BoxedObject Plane where
    boxedType :: Plane -> IO GType
boxedType _ = IO GType
c_graphene_plane_get_type

-- | Convert 'Plane' to and from 'Data.GI.Base.GValue.GValue' with 'Data.GI.Base.GValue.toGValue' and 'Data.GI.Base.GValue.fromGValue'.
instance B.GValue.IsGValue Plane where
    toGValue :: Plane -> IO GValue
toGValue o :: Plane
o = do
        GType
gtype <- IO GType
c_graphene_plane_get_type
        Plane -> (Ptr Plane -> IO GValue) -> IO GValue
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr Plane
o (GType -> (GValue -> Ptr Plane -> IO ()) -> Ptr Plane -> IO GValue
forall a. GType -> (GValue -> a -> IO ()) -> a -> IO GValue
B.GValue.buildGValue GType
gtype GValue -> Ptr Plane -> IO ()
forall a. GValue -> Ptr a -> IO ()
B.GValue.set_boxed)
        
    fromGValue :: GValue -> IO Plane
fromGValue gv :: GValue
gv = do
        Ptr Plane
ptr <- GValue -> IO (Ptr Plane)
forall b. GValue -> IO (Ptr b)
B.GValue.get_boxed GValue
gv :: IO (Ptr Plane)
        (ManagedPtr Plane -> Plane) -> Ptr Plane -> IO Plane
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
B.ManagedPtr.newBoxed ManagedPtr Plane -> Plane
Plane Ptr Plane
ptr
        
    

-- | Construct a `Plane` struct initialized to zero.
newZeroPlane :: MonadIO m => m Plane
newZeroPlane :: m Plane
newZeroPlane = IO Plane -> m Plane
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Plane -> m Plane) -> IO Plane -> m Plane
forall a b. (a -> b) -> a -> b
$ Int -> IO (Ptr Plane)
forall a. BoxedObject a => Int -> IO (Ptr a)
callocBoxedBytes 20 IO (Ptr Plane) -> (Ptr Plane -> IO Plane) -> IO Plane
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= (ManagedPtr Plane -> Plane) -> Ptr Plane -> IO Plane
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Plane -> Plane
Plane

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


-- | A convenience alias for `Nothing` :: `Maybe` `Plane`.
noPlane :: Maybe Plane
noPlane :: Maybe Plane
noPlane = Maybe Plane
forall a. Maybe a
Nothing


#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList Plane
type instance O.AttributeList Plane = PlaneAttributeList
type PlaneAttributeList = ('[ ] :: [(Symbol, *)])
#endif

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

foreign import ccall "graphene_plane_alloc" graphene_plane_alloc :: 
    IO (Ptr Plane)

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

#if defined(ENABLE_OVERLOADING)
#endif

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

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

-- | Computes the distance of /@point@/ from a t'GI.Graphene.Structs.Plane.Plane'.
-- 
-- /Since: 1.2/
planeDistance ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Plane
    -- ^ /@p@/: a t'GI.Graphene.Structs.Plane.Plane'
    -> Graphene.Point3D.Point3D
    -- ^ /@point@/: a t'GI.Graphene.Structs.Point3D.Point3D'
    -> m Float
    -- ^ __Returns:__ the distance of the given t'GI.Graphene.Structs.Point3D.Point3D' from the plane
planeDistance :: Plane -> Point3D -> m Float
planeDistance p :: Plane
p point :: Point3D
point = IO Float -> m Float
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
    Ptr Plane
p' <- Plane -> IO (Ptr Plane)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Plane
p
    Ptr Point3D
point' <- Point3D -> IO (Ptr Point3D)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Point3D
point
    CFloat
result <- Ptr Plane -> Ptr Point3D -> IO CFloat
graphene_plane_distance Ptr Plane
p' Ptr Point3D
point'
    let result' :: Float
result' = CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac CFloat
result
    Plane -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Plane
p
    Point3D -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Point3D
point
    Float -> IO Float
forall (m :: * -> *) a. Monad m => a -> m a
return Float
result'

#if defined(ENABLE_OVERLOADING)
data PlaneDistanceMethodInfo
instance (signature ~ (Graphene.Point3D.Point3D -> m Float), MonadIO m) => O.MethodInfo PlaneDistanceMethodInfo Plane signature where
    overloadedMethod = planeDistance

#endif

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

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

-- | Checks whether the two given t'GI.Graphene.Structs.Plane.Plane' are equal.
-- 
-- /Since: 1.2/
planeEqual ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Plane
    -- ^ /@a@/: a t'GI.Graphene.Structs.Plane.Plane'
    -> Plane
    -- ^ /@b@/: a t'GI.Graphene.Structs.Plane.Plane'
    -> m Bool
    -- ^ __Returns:__ @true@ if the given planes are equal
planeEqual :: Plane -> Plane -> m Bool
planeEqual a :: Plane
a b :: Plane
b = IO Bool -> m Bool
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
    Ptr Plane
a' <- Plane -> IO (Ptr Plane)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Plane
a
    Ptr Plane
b' <- Plane -> IO (Ptr Plane)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Plane
b
    CInt
result <- Ptr Plane -> Ptr Plane -> IO CInt
graphene_plane_equal Ptr Plane
a' Ptr Plane
b'
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= 0) CInt
result
    Plane -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Plane
a
    Plane -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Plane
b
    Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'

#if defined(ENABLE_OVERLOADING)
data PlaneEqualMethodInfo
instance (signature ~ (Plane -> m Bool), MonadIO m) => O.MethodInfo PlaneEqualMethodInfo Plane signature where
    overloadedMethod = planeEqual

#endif

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

foreign import ccall "graphene_plane_free" graphene_plane_free :: 
    Ptr Plane ->                            -- p : TInterface (Name {namespace = "Graphene", name = "Plane"})
    IO ()

-- | Frees the resources allocated by 'GI.Graphene.Structs.Plane.planeAlloc'.
-- 
-- /Since: 1.2/
planeFree ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Plane
    -- ^ /@p@/: a t'GI.Graphene.Structs.Plane.Plane'
    -> m ()
planeFree :: Plane -> m ()
planeFree p :: Plane
p = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr Plane
p' <- Plane -> IO (Ptr Plane)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Plane
p
    Ptr Plane -> IO ()
graphene_plane_free Ptr Plane
p'
    Plane -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Plane
p
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
data PlaneFreeMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.MethodInfo PlaneFreeMethodInfo Plane signature where
    overloadedMethod = planeFree

#endif

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

foreign import ccall "graphene_plane_get_constant" graphene_plane_get_constant :: 
    Ptr Plane ->                            -- p : TInterface (Name {namespace = "Graphene", name = "Plane"})
    IO CFloat

-- | Retrieves the distance along the normal vector of the
-- given t'GI.Graphene.Structs.Plane.Plane' from the origin.
-- 
-- /Since: 1.2/
planeGetConstant ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Plane
    -- ^ /@p@/: a t'GI.Graphene.Structs.Plane.Plane'
    -> m Float
    -- ^ __Returns:__ the constant value of the plane
planeGetConstant :: Plane -> m Float
planeGetConstant p :: Plane
p = IO Float -> m Float
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
    Ptr Plane
p' <- Plane -> IO (Ptr Plane)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Plane
p
    CFloat
result <- Ptr Plane -> IO CFloat
graphene_plane_get_constant Ptr Plane
p'
    let result' :: Float
result' = CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac CFloat
result
    Plane -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Plane
p
    Float -> IO Float
forall (m :: * -> *) a. Monad m => a -> m a
return Float
result'

#if defined(ENABLE_OVERLOADING)
data PlaneGetConstantMethodInfo
instance (signature ~ (m Float), MonadIO m) => O.MethodInfo PlaneGetConstantMethodInfo Plane signature where
    overloadedMethod = planeGetConstant

#endif

-- method Plane::get_normal
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "p"
--           , argType =
--               TInterface Name { namespace = "Graphene" , name = "Plane" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #graphene_plane_t"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "normal"
--           , argType =
--               TInterface Name { namespace = "Graphene" , name = "Vec3" }
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "return location for the normal vector"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = True
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "graphene_plane_get_normal" graphene_plane_get_normal :: 
    Ptr Plane ->                            -- p : TInterface (Name {namespace = "Graphene", name = "Plane"})
    Ptr Graphene.Vec3.Vec3 ->               -- normal : TInterface (Name {namespace = "Graphene", name = "Vec3"})
    IO ()

-- | Retrieves the normal vector pointing towards the origin of the
-- given t'GI.Graphene.Structs.Plane.Plane'.
-- 
-- /Since: 1.2/
planeGetNormal ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Plane
    -- ^ /@p@/: a t'GI.Graphene.Structs.Plane.Plane'
    -> m (Graphene.Vec3.Vec3)
planeGetNormal :: Plane -> m Vec3
planeGetNormal p :: Plane
p = IO Vec3 -> m Vec3
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Vec3 -> m Vec3) -> IO Vec3 -> m Vec3
forall a b. (a -> b) -> a -> b
$ do
    Ptr Plane
p' <- Plane -> IO (Ptr Plane)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Plane
p
    Ptr Vec3
normal <- Int -> IO (Ptr Vec3)
forall a. BoxedObject a => Int -> IO (Ptr a)
callocBoxedBytes 16 :: IO (Ptr Graphene.Vec3.Vec3)
    Ptr Plane -> Ptr Vec3 -> IO ()
graphene_plane_get_normal Ptr Plane
p' Ptr Vec3
normal
    Vec3
normal' <- ((ManagedPtr Vec3 -> Vec3) -> Ptr Vec3 -> IO Vec3
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Vec3 -> Vec3
Graphene.Vec3.Vec3) Ptr Vec3
normal
    Plane -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Plane
p
    Vec3 -> IO Vec3
forall (m :: * -> *) a. Monad m => a -> m a
return Vec3
normal'

#if defined(ENABLE_OVERLOADING)
data PlaneGetNormalMethodInfo
instance (signature ~ (m (Graphene.Vec3.Vec3)), MonadIO m) => O.MethodInfo PlaneGetNormalMethodInfo Plane signature where
    overloadedMethod = planeGetNormal

#endif

-- method Plane::init
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "p"
--           , argType =
--               TInterface Name { namespace = "Graphene" , name = "Plane" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the #graphene_plane_t to initialize"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "normal"
--           , argType =
--               TInterface Name { namespace = "Graphene" , name = "Vec3" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "a unit length normal vector defining the plane\n  pointing towards the origin; if unset, we use the X axis by default"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "constant"
--           , argType = TBasicType TFloat
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "the distance from the origin to the plane along the\n  normal vector; the sign determines the half-space occupied by the\n  plane"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Graphene" , name = "Plane" })
-- throws : False
-- Skip return : False

foreign import ccall "graphene_plane_init" graphene_plane_init :: 
    Ptr Plane ->                            -- p : TInterface (Name {namespace = "Graphene", name = "Plane"})
    Ptr Graphene.Vec3.Vec3 ->               -- normal : TInterface (Name {namespace = "Graphene", name = "Vec3"})
    CFloat ->                               -- constant : TBasicType TFloat
    IO (Ptr Plane)

-- | Initializes the given t'GI.Graphene.Structs.Plane.Plane' using the given /@normal@/ vector
-- and /@constant@/ values.
-- 
-- /Since: 1.2/
planeInit ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Plane
    -- ^ /@p@/: the t'GI.Graphene.Structs.Plane.Plane' to initialize
    -> Maybe (Graphene.Vec3.Vec3)
    -- ^ /@normal@/: a unit length normal vector defining the plane
    --   pointing towards the origin; if unset, we use the X axis by default
    -> Float
    -- ^ /@constant@/: the distance from the origin to the plane along the
    --   normal vector; the sign determines the half-space occupied by the
    --   plane
    -> m Plane
    -- ^ __Returns:__ the initialized plane
planeInit :: Plane -> Maybe Vec3 -> Float -> m Plane
planeInit p :: Plane
p normal :: Maybe Vec3
normal constant :: Float
constant = IO Plane -> m Plane
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Plane -> m Plane) -> IO Plane -> m Plane
forall a b. (a -> b) -> a -> b
$ do
    Ptr Plane
p' <- Plane -> IO (Ptr Plane)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Plane
p
    Ptr Vec3
maybeNormal <- case Maybe Vec3
normal of
        Nothing -> Ptr Vec3 -> IO (Ptr Vec3)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Vec3
forall a. Ptr a
nullPtr
        Just jNormal :: Vec3
jNormal -> do
            Ptr Vec3
jNormal' <- Vec3 -> IO (Ptr Vec3)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Vec3
jNormal
            Ptr Vec3 -> IO (Ptr Vec3)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Vec3
jNormal'
    let constant' :: CFloat
constant' = Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
constant
    Ptr Plane
result <- Ptr Plane -> Ptr Vec3 -> CFloat -> IO (Ptr Plane)
graphene_plane_init Ptr Plane
p' Ptr Vec3
maybeNormal CFloat
constant'
    Text -> Ptr Plane -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "planeInit" Ptr Plane
result
    Plane
result' <- ((ManagedPtr Plane -> Plane) -> Ptr Plane -> IO Plane
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newBoxed ManagedPtr Plane -> Plane
Plane) Ptr Plane
result
    Plane -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Plane
p
    Maybe Vec3 -> (Vec3 -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe Vec3
normal Vec3 -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
    Plane -> IO Plane
forall (m :: * -> *) a. Monad m => a -> m a
return Plane
result'

#if defined(ENABLE_OVERLOADING)
data PlaneInitMethodInfo
instance (signature ~ (Maybe (Graphene.Vec3.Vec3) -> Float -> m Plane), MonadIO m) => O.MethodInfo PlaneInitMethodInfo Plane signature where
    overloadedMethod = planeInit

#endif

-- method Plane::init_from_plane
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "p"
--           , argType =
--               TInterface Name { namespace = "Graphene" , name = "Plane" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the #graphene_plane_t to initialize"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "src"
--           , argType =
--               TInterface Name { namespace = "Graphene" , name = "Plane" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #graphene_plane_t"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Graphene" , name = "Plane" })
-- throws : False
-- Skip return : False

foreign import ccall "graphene_plane_init_from_plane" graphene_plane_init_from_plane :: 
    Ptr Plane ->                            -- p : TInterface (Name {namespace = "Graphene", name = "Plane"})
    Ptr Plane ->                            -- src : TInterface (Name {namespace = "Graphene", name = "Plane"})
    IO (Ptr Plane)

-- | Initializes the given t'GI.Graphene.Structs.Plane.Plane' using the normal
-- vector and constant of another t'GI.Graphene.Structs.Plane.Plane'.
-- 
-- /Since: 1.2/
planeInitFromPlane ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Plane
    -- ^ /@p@/: the t'GI.Graphene.Structs.Plane.Plane' to initialize
    -> Plane
    -- ^ /@src@/: a t'GI.Graphene.Structs.Plane.Plane'
    -> m Plane
    -- ^ __Returns:__ the initialized plane
planeInitFromPlane :: Plane -> Plane -> m Plane
planeInitFromPlane p :: Plane
p src :: Plane
src = IO Plane -> m Plane
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Plane -> m Plane) -> IO Plane -> m Plane
forall a b. (a -> b) -> a -> b
$ do
    Ptr Plane
p' <- Plane -> IO (Ptr Plane)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Plane
p
    Ptr Plane
src' <- Plane -> IO (Ptr Plane)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Plane
src
    Ptr Plane
result <- Ptr Plane -> Ptr Plane -> IO (Ptr Plane)
graphene_plane_init_from_plane Ptr Plane
p' Ptr Plane
src'
    Text -> Ptr Plane -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "planeInitFromPlane" Ptr Plane
result
    Plane
result' <- ((ManagedPtr Plane -> Plane) -> Ptr Plane -> IO Plane
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newBoxed ManagedPtr Plane -> Plane
Plane) Ptr Plane
result
    Plane -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Plane
p
    Plane -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Plane
src
    Plane -> IO Plane
forall (m :: * -> *) a. Monad m => a -> m a
return Plane
result'

#if defined(ENABLE_OVERLOADING)
data PlaneInitFromPlaneMethodInfo
instance (signature ~ (Plane -> m Plane), MonadIO m) => O.MethodInfo PlaneInitFromPlaneMethodInfo Plane signature where
    overloadedMethod = planeInitFromPlane

#endif

-- method Plane::init_from_point
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "p"
--           , argType =
--               TInterface Name { namespace = "Graphene" , name = "Plane" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the #graphene_plane_t to initialize"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "normal"
--           , argType =
--               TInterface Name { namespace = "Graphene" , name = "Vec3" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "a normal vector defining the plane pointing towards the origin"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "point"
--           , argType =
--               TInterface Name { namespace = "Graphene" , name = "Point3D" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #graphene_point3d_t"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Graphene" , name = "Plane" })
-- throws : False
-- Skip return : False

foreign import ccall "graphene_plane_init_from_point" graphene_plane_init_from_point :: 
    Ptr Plane ->                            -- p : TInterface (Name {namespace = "Graphene", name = "Plane"})
    Ptr Graphene.Vec3.Vec3 ->               -- normal : TInterface (Name {namespace = "Graphene", name = "Vec3"})
    Ptr Graphene.Point3D.Point3D ->         -- point : TInterface (Name {namespace = "Graphene", name = "Point3D"})
    IO (Ptr Plane)

-- | Initializes the given t'GI.Graphene.Structs.Plane.Plane' using the given normal vector
-- and an arbitrary co-planar point.
-- 
-- /Since: 1.2/
planeInitFromPoint ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Plane
    -- ^ /@p@/: the t'GI.Graphene.Structs.Plane.Plane' to initialize
    -> Graphene.Vec3.Vec3
    -- ^ /@normal@/: a normal vector defining the plane pointing towards the origin
    -> Graphene.Point3D.Point3D
    -- ^ /@point@/: a t'GI.Graphene.Structs.Point3D.Point3D'
    -> m Plane
    -- ^ __Returns:__ the initialized plane
planeInitFromPoint :: Plane -> Vec3 -> Point3D -> m Plane
planeInitFromPoint p :: Plane
p normal :: Vec3
normal point :: Point3D
point = IO Plane -> m Plane
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Plane -> m Plane) -> IO Plane -> m Plane
forall a b. (a -> b) -> a -> b
$ do
    Ptr Plane
p' <- Plane -> IO (Ptr Plane)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Plane
p
    Ptr Vec3
normal' <- Vec3 -> IO (Ptr Vec3)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Vec3
normal
    Ptr Point3D
point' <- Point3D -> IO (Ptr Point3D)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Point3D
point
    Ptr Plane
result <- Ptr Plane -> Ptr Vec3 -> Ptr Point3D -> IO (Ptr Plane)
graphene_plane_init_from_point Ptr Plane
p' Ptr Vec3
normal' Ptr Point3D
point'
    Text -> Ptr Plane -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "planeInitFromPoint" Ptr Plane
result
    Plane
result' <- ((ManagedPtr Plane -> Plane) -> Ptr Plane -> IO Plane
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newBoxed ManagedPtr Plane -> Plane
Plane) Ptr Plane
result
    Plane -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Plane
p
    Vec3 -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Vec3
normal
    Point3D -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Point3D
point
    Plane -> IO Plane
forall (m :: * -> *) a. Monad m => a -> m a
return Plane
result'

#if defined(ENABLE_OVERLOADING)
data PlaneInitFromPointMethodInfo
instance (signature ~ (Graphene.Vec3.Vec3 -> Graphene.Point3D.Point3D -> m Plane), MonadIO m) => O.MethodInfo PlaneInitFromPointMethodInfo Plane signature where
    overloadedMethod = planeInitFromPoint

#endif

-- method Plane::init_from_points
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "p"
--           , argType =
--               TInterface Name { namespace = "Graphene" , name = "Plane" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the #graphene_plane_t to initialize"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "a"
--           , argType =
--               TInterface Name { namespace = "Graphene" , name = "Point3D" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #graphene_point3d_t"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "b"
--           , argType =
--               TInterface Name { namespace = "Graphene" , name = "Point3D" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #graphene_point3d_t"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "c"
--           , argType =
--               TInterface Name { namespace = "Graphene" , name = "Point3D" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #graphene_point3d_t"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Graphene" , name = "Plane" })
-- throws : False
-- Skip return : False

foreign import ccall "graphene_plane_init_from_points" graphene_plane_init_from_points :: 
    Ptr Plane ->                            -- p : TInterface (Name {namespace = "Graphene", name = "Plane"})
    Ptr Graphene.Point3D.Point3D ->         -- a : TInterface (Name {namespace = "Graphene", name = "Point3D"})
    Ptr Graphene.Point3D.Point3D ->         -- b : TInterface (Name {namespace = "Graphene", name = "Point3D"})
    Ptr Graphene.Point3D.Point3D ->         -- c : TInterface (Name {namespace = "Graphene", name = "Point3D"})
    IO (Ptr Plane)

-- | Initializes the given t'GI.Graphene.Structs.Plane.Plane' using the 3 provided co-planar
-- points.
-- 
-- The winding order is counter-clockwise, and determines which direction
-- the normal vector will point.
-- 
-- /Since: 1.2/
planeInitFromPoints ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Plane
    -- ^ /@p@/: the t'GI.Graphene.Structs.Plane.Plane' to initialize
    -> Graphene.Point3D.Point3D
    -- ^ /@a@/: a t'GI.Graphene.Structs.Point3D.Point3D'
    -> Graphene.Point3D.Point3D
    -- ^ /@b@/: a t'GI.Graphene.Structs.Point3D.Point3D'
    -> Graphene.Point3D.Point3D
    -- ^ /@c@/: a t'GI.Graphene.Structs.Point3D.Point3D'
    -> m Plane
    -- ^ __Returns:__ the initialized plane
planeInitFromPoints :: Plane -> Point3D -> Point3D -> Point3D -> m Plane
planeInitFromPoints p :: Plane
p a :: Point3D
a b :: Point3D
b c :: Point3D
c = IO Plane -> m Plane
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Plane -> m Plane) -> IO Plane -> m Plane
forall a b. (a -> b) -> a -> b
$ do
    Ptr Plane
p' <- Plane -> IO (Ptr Plane)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Plane
p
    Ptr Point3D
a' <- Point3D -> IO (Ptr Point3D)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Point3D
a
    Ptr Point3D
b' <- Point3D -> IO (Ptr Point3D)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Point3D
b
    Ptr Point3D
c' <- Point3D -> IO (Ptr Point3D)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Point3D
c
    Ptr Plane
result <- Ptr Plane
-> Ptr Point3D -> Ptr Point3D -> Ptr Point3D -> IO (Ptr Plane)
graphene_plane_init_from_points Ptr Plane
p' Ptr Point3D
a' Ptr Point3D
b' Ptr Point3D
c'
    Text -> Ptr Plane -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "planeInitFromPoints" Ptr Plane
result
    Plane
result' <- ((ManagedPtr Plane -> Plane) -> Ptr Plane -> IO Plane
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newBoxed ManagedPtr Plane -> Plane
Plane) Ptr Plane
result
    Plane -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Plane
p
    Point3D -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Point3D
a
    Point3D -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Point3D
b
    Point3D -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Point3D
c
    Plane -> IO Plane
forall (m :: * -> *) a. Monad m => a -> m a
return Plane
result'

#if defined(ENABLE_OVERLOADING)
data PlaneInitFromPointsMethodInfo
instance (signature ~ (Graphene.Point3D.Point3D -> Graphene.Point3D.Point3D -> Graphene.Point3D.Point3D -> m Plane), MonadIO m) => O.MethodInfo PlaneInitFromPointsMethodInfo Plane signature where
    overloadedMethod = planeInitFromPoints

#endif

-- method Plane::init_from_vec4
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "p"
--           , argType =
--               TInterface Name { namespace = "Graphene" , name = "Plane" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the #graphene_plane_t to initialize"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "src"
--           , argType =
--               TInterface Name { namespace = "Graphene" , name = "Vec4" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "a #graphene_vec4_t containing the normal vector in its first\n  three components, and the distance in its fourth component"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Graphene" , name = "Plane" })
-- throws : False
-- Skip return : False

foreign import ccall "graphene_plane_init_from_vec4" graphene_plane_init_from_vec4 :: 
    Ptr Plane ->                            -- p : TInterface (Name {namespace = "Graphene", name = "Plane"})
    Ptr Graphene.Vec4.Vec4 ->               -- src : TInterface (Name {namespace = "Graphene", name = "Vec4"})
    IO (Ptr Plane)

-- | Initializes the given t'GI.Graphene.Structs.Plane.Plane' using the components of
-- the given t'GI.Graphene.Structs.Vec4.Vec4' vector.
-- 
-- /Since: 1.2/
planeInitFromVec4 ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Plane
    -- ^ /@p@/: the t'GI.Graphene.Structs.Plane.Plane' to initialize
    -> Graphene.Vec4.Vec4
    -- ^ /@src@/: a t'GI.Graphene.Structs.Vec4.Vec4' containing the normal vector in its first
    --   three components, and the distance in its fourth component
    -> m Plane
    -- ^ __Returns:__ the initialized plane
planeInitFromVec4 :: Plane -> Vec4 -> m Plane
planeInitFromVec4 p :: Plane
p src :: Vec4
src = IO Plane -> m Plane
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Plane -> m Plane) -> IO Plane -> m Plane
forall a b. (a -> b) -> a -> b
$ do
    Ptr Plane
p' <- Plane -> IO (Ptr Plane)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Plane
p
    Ptr Vec4
src' <- Vec4 -> IO (Ptr Vec4)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Vec4
src
    Ptr Plane
result <- Ptr Plane -> Ptr Vec4 -> IO (Ptr Plane)
graphene_plane_init_from_vec4 Ptr Plane
p' Ptr Vec4
src'
    Text -> Ptr Plane -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "planeInitFromVec4" Ptr Plane
result
    Plane
result' <- ((ManagedPtr Plane -> Plane) -> Ptr Plane -> IO Plane
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newBoxed ManagedPtr Plane -> Plane
Plane) Ptr Plane
result
    Plane -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Plane
p
    Vec4 -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Vec4
src
    Plane -> IO Plane
forall (m :: * -> *) a. Monad m => a -> m a
return Plane
result'

#if defined(ENABLE_OVERLOADING)
data PlaneInitFromVec4MethodInfo
instance (signature ~ (Graphene.Vec4.Vec4 -> m Plane), MonadIO m) => O.MethodInfo PlaneInitFromVec4MethodInfo Plane signature where
    overloadedMethod = planeInitFromVec4

#endif

-- method Plane::negate
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "p"
--           , argType =
--               TInterface Name { namespace = "Graphene" , name = "Plane" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #graphene_plane_t"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "res"
--           , argType =
--               TInterface Name { namespace = "Graphene" , name = "Plane" }
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "return location for the negated plane"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = True
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "graphene_plane_negate" graphene_plane_negate :: 
    Ptr Plane ->                            -- p : TInterface (Name {namespace = "Graphene", name = "Plane"})
    Ptr Plane ->                            -- res : TInterface (Name {namespace = "Graphene", name = "Plane"})
    IO ()

-- | Negates the normal vector and constant of a t'GI.Graphene.Structs.Plane.Plane', effectively
-- mirroring the plane across the origin.
-- 
-- /Since: 1.2/
planeNegate ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Plane
    -- ^ /@p@/: a t'GI.Graphene.Structs.Plane.Plane'
    -> m (Plane)
planeNegate :: Plane -> m Plane
planeNegate p :: Plane
p = IO Plane -> m Plane
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Plane -> m Plane) -> IO Plane -> m Plane
forall a b. (a -> b) -> a -> b
$ do
    Ptr Plane
p' <- Plane -> IO (Ptr Plane)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Plane
p
    Ptr Plane
res <- Int -> IO (Ptr Plane)
forall a. BoxedObject a => Int -> IO (Ptr a)
callocBoxedBytes 20 :: IO (Ptr Plane)
    Ptr Plane -> Ptr Plane -> IO ()
graphene_plane_negate Ptr Plane
p' Ptr Plane
res
    Plane
res' <- ((ManagedPtr Plane -> Plane) -> Ptr Plane -> IO Plane
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Plane -> Plane
Plane) Ptr Plane
res
    Plane -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Plane
p
    Plane -> IO Plane
forall (m :: * -> *) a. Monad m => a -> m a
return Plane
res'

#if defined(ENABLE_OVERLOADING)
data PlaneNegateMethodInfo
instance (signature ~ (m (Plane)), MonadIO m) => O.MethodInfo PlaneNegateMethodInfo Plane signature where
    overloadedMethod = planeNegate

#endif

-- method Plane::normalize
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "p"
--           , argType =
--               TInterface Name { namespace = "Graphene" , name = "Plane" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #graphene_plane_t"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "res"
--           , argType =
--               TInterface Name { namespace = "Graphene" , name = "Plane" }
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "return location for the normalized plane"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = True
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "graphene_plane_normalize" graphene_plane_normalize :: 
    Ptr Plane ->                            -- p : TInterface (Name {namespace = "Graphene", name = "Plane"})
    Ptr Plane ->                            -- res : TInterface (Name {namespace = "Graphene", name = "Plane"})
    IO ()

-- | Normalizes the vector of the given t'GI.Graphene.Structs.Plane.Plane',
-- and adjusts the constant accordingly.
-- 
-- /Since: 1.2/
planeNormalize ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Plane
    -- ^ /@p@/: a t'GI.Graphene.Structs.Plane.Plane'
    -> m (Plane)
planeNormalize :: Plane -> m Plane
planeNormalize p :: Plane
p = IO Plane -> m Plane
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Plane -> m Plane) -> IO Plane -> m Plane
forall a b. (a -> b) -> a -> b
$ do
    Ptr Plane
p' <- Plane -> IO (Ptr Plane)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Plane
p
    Ptr Plane
res <- Int -> IO (Ptr Plane)
forall a. BoxedObject a => Int -> IO (Ptr a)
callocBoxedBytes 20 :: IO (Ptr Plane)
    Ptr Plane -> Ptr Plane -> IO ()
graphene_plane_normalize Ptr Plane
p' Ptr Plane
res
    Plane
res' <- ((ManagedPtr Plane -> Plane) -> Ptr Plane -> IO Plane
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Plane -> Plane
Plane) Ptr Plane
res
    Plane -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Plane
p
    Plane -> IO Plane
forall (m :: * -> *) a. Monad m => a -> m a
return Plane
res'

#if defined(ENABLE_OVERLOADING)
data PlaneNormalizeMethodInfo
instance (signature ~ (m (Plane)), MonadIO m) => O.MethodInfo PlaneNormalizeMethodInfo Plane signature where
    overloadedMethod = planeNormalize

#endif

#if defined(ENABLE_OVERLOADING)
type family ResolvePlaneMethod (t :: Symbol) (o :: *) :: * where
    ResolvePlaneMethod "distance" o = PlaneDistanceMethodInfo
    ResolvePlaneMethod "equal" o = PlaneEqualMethodInfo
    ResolvePlaneMethod "free" o = PlaneFreeMethodInfo
    ResolvePlaneMethod "init" o = PlaneInitMethodInfo
    ResolvePlaneMethod "initFromPlane" o = PlaneInitFromPlaneMethodInfo
    ResolvePlaneMethod "initFromPoint" o = PlaneInitFromPointMethodInfo
    ResolvePlaneMethod "initFromPoints" o = PlaneInitFromPointsMethodInfo
    ResolvePlaneMethod "initFromVec4" o = PlaneInitFromVec4MethodInfo
    ResolvePlaneMethod "negate" o = PlaneNegateMethodInfo
    ResolvePlaneMethod "normalize" o = PlaneNormalizeMethodInfo
    ResolvePlaneMethod "getConstant" o = PlaneGetConstantMethodInfo
    ResolvePlaneMethod "getNormal" o = PlaneGetNormalMethodInfo
    ResolvePlaneMethod l o = O.MethodResolutionFailed l o

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

#endif