{-# LANGUAGE TypeApplications #-}


-- | Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria
-- 
-- A triangle.
-- 
-- /Since: 1.2/

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

module GI.Graphene.Structs.Triangle
    ( 

-- * Exported types
    Triangle(..)                            ,
    newZeroTriangle                         ,


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

#if defined(ENABLE_OVERLOADING)
    ResolveTriangleMethod                   ,
#endif


-- ** alloc #method:alloc#

    triangleAlloc                           ,


-- ** containsPoint #method:containsPoint#

#if defined(ENABLE_OVERLOADING)
    TriangleContainsPointMethodInfo         ,
#endif
    triangleContainsPoint                   ,


-- ** equal #method:equal#

#if defined(ENABLE_OVERLOADING)
    TriangleEqualMethodInfo                 ,
#endif
    triangleEqual                           ,


-- ** free #method:free#

#if defined(ENABLE_OVERLOADING)
    TriangleFreeMethodInfo                  ,
#endif
    triangleFree                            ,


-- ** getArea #method:getArea#

#if defined(ENABLE_OVERLOADING)
    TriangleGetAreaMethodInfo               ,
#endif
    triangleGetArea                         ,


-- ** getBarycoords #method:getBarycoords#

#if defined(ENABLE_OVERLOADING)
    TriangleGetBarycoordsMethodInfo         ,
#endif
    triangleGetBarycoords                   ,


-- ** getBoundingBox #method:getBoundingBox#

#if defined(ENABLE_OVERLOADING)
    TriangleGetBoundingBoxMethodInfo        ,
#endif
    triangleGetBoundingBox                  ,


-- ** getMidpoint #method:getMidpoint#

#if defined(ENABLE_OVERLOADING)
    TriangleGetMidpointMethodInfo           ,
#endif
    triangleGetMidpoint                     ,


-- ** getNormal #method:getNormal#

#if defined(ENABLE_OVERLOADING)
    TriangleGetNormalMethodInfo             ,
#endif
    triangleGetNormal                       ,


-- ** getPlane #method:getPlane#

#if defined(ENABLE_OVERLOADING)
    TriangleGetPlaneMethodInfo              ,
#endif
    triangleGetPlane                        ,


-- ** getPoints #method:getPoints#

#if defined(ENABLE_OVERLOADING)
    TriangleGetPointsMethodInfo             ,
#endif
    triangleGetPoints                       ,


-- ** getUv #method:getUv#

#if defined(ENABLE_OVERLOADING)
    TriangleGetUvMethodInfo                 ,
#endif
    triangleGetUv                           ,


-- ** getVertices #method:getVertices#

#if defined(ENABLE_OVERLOADING)
    TriangleGetVerticesMethodInfo           ,
#endif
    triangleGetVertices                     ,


-- ** initFromFloat #method:initFromFloat#

#if defined(ENABLE_OVERLOADING)
    TriangleInitFromFloatMethodInfo         ,
#endif
    triangleInitFromFloat                   ,


-- ** initFromPoint3d #method:initFromPoint3d#

#if defined(ENABLE_OVERLOADING)
    TriangleInitFromPoint3dMethodInfo       ,
#endif
    triangleInitFromPoint3d                 ,


-- ** initFromVec3 #method:initFromVec3#

#if defined(ENABLE_OVERLOADING)
    TriangleInitFromVec3MethodInfo          ,
#endif
    triangleInitFromVec3                    ,




    ) 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.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 Control.Monad.IO.Class as MIO
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.Box as Graphene.Box
import {-# SOURCE #-} qualified GI.Graphene.Structs.Plane as Graphene.Plane
import {-# SOURCE #-} qualified GI.Graphene.Structs.Point3D as Graphene.Point3D
import {-# SOURCE #-} qualified GI.Graphene.Structs.Vec2 as Graphene.Vec2
import {-# SOURCE #-} qualified GI.Graphene.Structs.Vec3 as Graphene.Vec3

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

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

foreign import ccall "graphene_triangle_get_type" c_graphene_triangle_get_type :: 
    IO GType

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

instance B.Types.TypedObject Triangle where
    glibType :: IO GType
glibType = IO GType
c_graphene_triangle_get_type

instance B.Types.GBoxed Triangle

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

-- | Construct a `Triangle` struct initialized to zero.
newZeroTriangle :: MonadIO m => m Triangle
newZeroTriangle :: m Triangle
newZeroTriangle = IO Triangle -> m Triangle
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Triangle -> m Triangle) -> IO Triangle -> m Triangle
forall a b. (a -> b) -> a -> b
$ Int -> IO (Ptr Triangle)
forall a. GBoxed a => Int -> IO (Ptr a)
callocBoxedBytes Int
48 IO (Ptr Triangle) -> (Ptr Triangle -> IO Triangle) -> IO Triangle
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= (ManagedPtr Triangle -> Triangle) -> Ptr Triangle -> IO Triangle
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Triangle -> Triangle
Triangle

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



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

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

foreign import ccall "graphene_triangle_alloc" graphene_triangle_alloc :: 
    IO (Ptr Triangle)

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

#if defined(ENABLE_OVERLOADING)
#endif

-- method Triangle::contains_point
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "t"
--           , argType =
--               TInterface Name { namespace = "Graphene" , name = "Triangle" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #graphene_triangle_t"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "p"
--           , 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 TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "graphene_triangle_contains_point" graphene_triangle_contains_point :: 
    Ptr Triangle ->                         -- t : TInterface (Name {namespace = "Graphene", name = "Triangle"})
    Ptr Graphene.Point3D.Point3D ->         -- p : TInterface (Name {namespace = "Graphene", name = "Point3D"})
    IO CInt

-- | Checks whether the given triangle /@t@/ contains the point /@p@/.
-- 
-- /Since: 1.2/
triangleContainsPoint ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Triangle
    -- ^ /@t@/: a t'GI.Graphene.Structs.Triangle.Triangle'
    -> Graphene.Point3D.Point3D
    -- ^ /@p@/: a t'GI.Graphene.Structs.Point3D.Point3D'
    -> m Bool
    -- ^ __Returns:__ @true@ if the point is inside the triangle
triangleContainsPoint :: Triangle -> Point3D -> m Bool
triangleContainsPoint Triangle
t Point3D
p = 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 Triangle
t' <- Triangle -> IO (Ptr Triangle)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Triangle
t
    Ptr Point3D
p' <- Point3D -> IO (Ptr Point3D)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Point3D
p
    CInt
result <- Ptr Triangle -> Ptr Point3D -> IO CInt
graphene_triangle_contains_point Ptr Triangle
t' Ptr Point3D
p'
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    Triangle -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Triangle
t
    Point3D -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Point3D
p
    Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'

#if defined(ENABLE_OVERLOADING)
data TriangleContainsPointMethodInfo
instance (signature ~ (Graphene.Point3D.Point3D -> m Bool), MonadIO m) => O.MethodInfo TriangleContainsPointMethodInfo Triangle signature where
    overloadedMethod = triangleContainsPoint

#endif

-- method Triangle::equal
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "a"
--           , argType =
--               TInterface Name { namespace = "Graphene" , name = "Triangle" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #graphene_triangle_t"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "b"
--           , argType =
--               TInterface Name { namespace = "Graphene" , name = "Triangle" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #graphene_triangle_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_triangle_equal" graphene_triangle_equal :: 
    Ptr Triangle ->                         -- a : TInterface (Name {namespace = "Graphene", name = "Triangle"})
    Ptr Triangle ->                         -- b : TInterface (Name {namespace = "Graphene", name = "Triangle"})
    IO CInt

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

#if defined(ENABLE_OVERLOADING)
data TriangleEqualMethodInfo
instance (signature ~ (Triangle -> m Bool), MonadIO m) => O.MethodInfo TriangleEqualMethodInfo Triangle signature where
    overloadedMethod = triangleEqual

#endif

-- method Triangle::free
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "t"
--           , argType =
--               TInterface Name { namespace = "Graphene" , name = "Triangle" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #graphene_triangle_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_triangle_free" graphene_triangle_free :: 
    Ptr Triangle ->                         -- t : TInterface (Name {namespace = "Graphene", name = "Triangle"})
    IO ()

-- | Frees the resources allocated by 'GI.Graphene.Structs.Triangle.triangleAlloc'.
-- 
-- /Since: 1.2/
triangleFree ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Triangle
    -- ^ /@t@/: a t'GI.Graphene.Structs.Triangle.Triangle'
    -> m ()
triangleFree :: Triangle -> m ()
triangleFree Triangle
t = 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 Triangle
t' <- Triangle -> IO (Ptr Triangle)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Triangle
t
    Ptr Triangle -> IO ()
graphene_triangle_free Ptr Triangle
t'
    Triangle -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Triangle
t
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
data TriangleFreeMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.MethodInfo TriangleFreeMethodInfo Triangle signature where
    overloadedMethod = triangleFree

#endif

-- method Triangle::get_area
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "t"
--           , argType =
--               TInterface Name { namespace = "Graphene" , name = "Triangle" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #graphene_triangle_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_triangle_get_area" graphene_triangle_get_area :: 
    Ptr Triangle ->                         -- t : TInterface (Name {namespace = "Graphene", name = "Triangle"})
    IO CFloat

-- | Computes the area of the given t'GI.Graphene.Structs.Triangle.Triangle'.
-- 
-- /Since: 1.2/
triangleGetArea ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Triangle
    -- ^ /@t@/: a t'GI.Graphene.Structs.Triangle.Triangle'
    -> m Float
    -- ^ __Returns:__ the area of the triangle
triangleGetArea :: Triangle -> m Float
triangleGetArea Triangle
t = 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 Triangle
t' <- Triangle -> IO (Ptr Triangle)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Triangle
t
    CFloat
result <- Ptr Triangle -> IO CFloat
graphene_triangle_get_area Ptr Triangle
t'
    let result' :: Float
result' = CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac CFloat
result
    Triangle -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Triangle
t
    Float -> IO Float
forall (m :: * -> *) a. Monad m => a -> m a
return Float
result'

#if defined(ENABLE_OVERLOADING)
data TriangleGetAreaMethodInfo
instance (signature ~ (m Float), MonadIO m) => O.MethodInfo TriangleGetAreaMethodInfo Triangle signature where
    overloadedMethod = triangleGetArea

#endif

-- method Triangle::get_barycoords
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "t"
--           , argType =
--               TInterface Name { namespace = "Graphene" , name = "Triangle" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #graphene_triangle_t"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "p"
--           , argType =
--               TInterface Name { namespace = "Graphene" , name = "Point3D" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #graphene_point3d_t"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "res"
--           , argType =
--               TInterface Name { namespace = "Graphene" , name = "Vec2" }
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "return location for the vector\n  with the barycentric coordinates"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = True
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "graphene_triangle_get_barycoords" graphene_triangle_get_barycoords :: 
    Ptr Triangle ->                         -- t : TInterface (Name {namespace = "Graphene", name = "Triangle"})
    Ptr Graphene.Point3D.Point3D ->         -- p : TInterface (Name {namespace = "Graphene", name = "Point3D"})
    Ptr Graphene.Vec2.Vec2 ->               -- res : TInterface (Name {namespace = "Graphene", name = "Vec2"})
    IO CInt

-- | Computes the <http://en.wikipedia.org/wiki/Barycentric_coordinate_system barycentric coordinates>
-- of the given point /@p@/.
-- 
-- The point /@p@/ must lie on the same plane as the triangle /@t@/; if the
-- point is not coplanar, the result of this function is undefined.
-- 
-- If we place the origin in the coordinates of the triangle\'s A point,
-- the barycentric coordinates are @u@, which is on the AC vector; and @v@
-- which is on the AB vector:
-- 
-- <<http://developer.gnome.org/graphene/stable/triangle-barycentric.png>>
-- 
-- The returned t'GI.Graphene.Structs.Vec2.Vec2' contains the following values, in order:
-- 
--  - @res.x = u@
--  - @res.y = v@
-- 
-- /Since: 1.2/
triangleGetBarycoords ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Triangle
    -- ^ /@t@/: a t'GI.Graphene.Structs.Triangle.Triangle'
    -> Maybe (Graphene.Point3D.Point3D)
    -- ^ /@p@/: a t'GI.Graphene.Structs.Point3D.Point3D'
    -> m ((Bool, Graphene.Vec2.Vec2))
    -- ^ __Returns:__ @true@ if the barycentric coordinates are valid
triangleGetBarycoords :: Triangle -> Maybe Point3D -> m (Bool, Vec2)
triangleGetBarycoords Triangle
t Maybe Point3D
p = IO (Bool, Vec2) -> m (Bool, Vec2)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Bool, Vec2) -> m (Bool, Vec2))
-> IO (Bool, Vec2) -> m (Bool, Vec2)
forall a b. (a -> b) -> a -> b
$ do
    Ptr Triangle
t' <- Triangle -> IO (Ptr Triangle)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Triangle
t
    Ptr Point3D
maybeP <- case Maybe Point3D
p of
        Maybe Point3D
Nothing -> Ptr Point3D -> IO (Ptr Point3D)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Point3D
forall a. Ptr a
nullPtr
        Just Point3D
jP -> do
            Ptr Point3D
jP' <- Point3D -> IO (Ptr Point3D)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Point3D
jP
            Ptr Point3D -> IO (Ptr Point3D)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Point3D
jP'
    Ptr Vec2
res <- Int -> IO (Ptr Vec2)
forall a. GBoxed a => Int -> IO (Ptr a)
SP.callocBoxedBytes Int
16 :: IO (Ptr Graphene.Vec2.Vec2)
    CInt
result <- Ptr Triangle -> Ptr Point3D -> Ptr Vec2 -> IO CInt
graphene_triangle_get_barycoords Ptr Triangle
t' Ptr Point3D
maybeP Ptr Vec2
res
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    Vec2
res' <- ((ManagedPtr Vec2 -> Vec2) -> Ptr Vec2 -> IO Vec2
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Vec2 -> Vec2
Graphene.Vec2.Vec2) Ptr Vec2
res
    Triangle -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Triangle
t
    Maybe Point3D -> (Point3D -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe Point3D
p Point3D -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
    (Bool, Vec2) -> IO (Bool, Vec2)
forall (m :: * -> *) a. Monad m => a -> m a
return (Bool
result', Vec2
res')

#if defined(ENABLE_OVERLOADING)
data TriangleGetBarycoordsMethodInfo
instance (signature ~ (Maybe (Graphene.Point3D.Point3D) -> m ((Bool, Graphene.Vec2.Vec2))), MonadIO m) => O.MethodInfo TriangleGetBarycoordsMethodInfo Triangle signature where
    overloadedMethod = triangleGetBarycoords

#endif

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

foreign import ccall "graphene_triangle_get_bounding_box" graphene_triangle_get_bounding_box :: 
    Ptr Triangle ->                         -- t : TInterface (Name {namespace = "Graphene", name = "Triangle"})
    Ptr Graphene.Box.Box ->                 -- res : TInterface (Name {namespace = "Graphene", name = "Box"})
    IO ()

-- | Computes the bounding box of the given t'GI.Graphene.Structs.Triangle.Triangle'.
-- 
-- /Since: 1.2/
triangleGetBoundingBox ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Triangle
    -- ^ /@t@/: a t'GI.Graphene.Structs.Triangle.Triangle'
    -> m (Graphene.Box.Box)
triangleGetBoundingBox :: Triangle -> m Box
triangleGetBoundingBox Triangle
t = IO Box -> m Box
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
    Ptr Triangle
t' <- Triangle -> IO (Ptr Triangle)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Triangle
t
    Ptr Box
res <- Int -> IO (Ptr Box)
forall a. GBoxed a => Int -> IO (Ptr a)
SP.callocBoxedBytes Int
32 :: IO (Ptr Graphene.Box.Box)
    Ptr Triangle -> Ptr Box -> IO ()
graphene_triangle_get_bounding_box Ptr Triangle
t' Ptr Box
res
    Box
res' <- ((ManagedPtr Box -> Box) -> Ptr Box -> IO Box
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Box -> Box
Graphene.Box.Box) Ptr Box
res
    Triangle -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Triangle
t
    Box -> IO Box
forall (m :: * -> *) a. Monad m => a -> m a
return Box
res'

#if defined(ENABLE_OVERLOADING)
data TriangleGetBoundingBoxMethodInfo
instance (signature ~ (m (Graphene.Box.Box)), MonadIO m) => O.MethodInfo TriangleGetBoundingBoxMethodInfo Triangle signature where
    overloadedMethod = triangleGetBoundingBox

#endif

-- method Triangle::get_midpoint
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "t"
--           , argType =
--               TInterface Name { namespace = "Graphene" , name = "Triangle" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #graphene_triangle_t"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "res"
--           , argType =
--               TInterface Name { namespace = "Graphene" , name = "Point3D" }
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "return location for the coordinates of\n  the midpoint"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = True
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "graphene_triangle_get_midpoint" graphene_triangle_get_midpoint :: 
    Ptr Triangle ->                         -- t : TInterface (Name {namespace = "Graphene", name = "Triangle"})
    Ptr Graphene.Point3D.Point3D ->         -- res : TInterface (Name {namespace = "Graphene", name = "Point3D"})
    IO ()

-- | Computes the coordinates of the midpoint of the given t'GI.Graphene.Structs.Triangle.Triangle'.
-- 
-- The midpoint G is the <https://en.wikipedia.org/wiki/Centroid#Triangle_centroid centroid>
-- of the triangle, i.e. the intersection of its medians.
-- 
-- /Since: 1.2/
triangleGetMidpoint ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Triangle
    -- ^ /@t@/: a t'GI.Graphene.Structs.Triangle.Triangle'
    -> m (Graphene.Point3D.Point3D)
triangleGetMidpoint :: Triangle -> m Point3D
triangleGetMidpoint Triangle
t = IO Point3D -> m Point3D
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
    Ptr Triangle
t' <- Triangle -> IO (Ptr Triangle)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Triangle
t
    Ptr Point3D
res <- Int -> IO (Ptr Point3D)
forall a. GBoxed a => Int -> IO (Ptr a)
SP.callocBoxedBytes Int
12 :: IO (Ptr Graphene.Point3D.Point3D)
    Ptr Triangle -> Ptr Point3D -> IO ()
graphene_triangle_get_midpoint Ptr Triangle
t' Ptr Point3D
res
    Point3D
res' <- ((ManagedPtr Point3D -> Point3D) -> Ptr Point3D -> IO Point3D
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Point3D -> Point3D
Graphene.Point3D.Point3D) Ptr Point3D
res
    Triangle -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Triangle
t
    Point3D -> IO Point3D
forall (m :: * -> *) a. Monad m => a -> m a
return Point3D
res'

#if defined(ENABLE_OVERLOADING)
data TriangleGetMidpointMethodInfo
instance (signature ~ (m (Graphene.Point3D.Point3D)), MonadIO m) => O.MethodInfo TriangleGetMidpointMethodInfo Triangle signature where
    overloadedMethod = triangleGetMidpoint

#endif

-- method Triangle::get_normal
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "t"
--           , argType =
--               TInterface Name { namespace = "Graphene" , name = "Triangle" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #graphene_triangle_t"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "res"
--           , 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_triangle_get_normal" graphene_triangle_get_normal :: 
    Ptr Triangle ->                         -- t : TInterface (Name {namespace = "Graphene", name = "Triangle"})
    Ptr Graphene.Vec3.Vec3 ->               -- res : TInterface (Name {namespace = "Graphene", name = "Vec3"})
    IO ()

-- | Computes the normal vector of the given t'GI.Graphene.Structs.Triangle.Triangle'.
-- 
-- /Since: 1.2/
triangleGetNormal ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Triangle
    -- ^ /@t@/: a t'GI.Graphene.Structs.Triangle.Triangle'
    -> m (Graphene.Vec3.Vec3)
triangleGetNormal :: Triangle -> m Vec3
triangleGetNormal Triangle
t = 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 Triangle
t' <- Triangle -> IO (Ptr Triangle)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Triangle
t
    Ptr Vec3
res <- Int -> IO (Ptr Vec3)
forall a. GBoxed a => Int -> IO (Ptr a)
SP.callocBoxedBytes Int
16 :: IO (Ptr Graphene.Vec3.Vec3)
    Ptr Triangle -> Ptr Vec3 -> IO ()
graphene_triangle_get_normal Ptr Triangle
t' Ptr Vec3
res
    Vec3
res' <- ((ManagedPtr Vec3 -> Vec3) -> Ptr Vec3 -> IO Vec3
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Vec3 -> Vec3
Graphene.Vec3.Vec3) Ptr Vec3
res
    Triangle -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Triangle
t
    Vec3 -> IO Vec3
forall (m :: * -> *) a. Monad m => a -> m a
return Vec3
res'

#if defined(ENABLE_OVERLOADING)
data TriangleGetNormalMethodInfo
instance (signature ~ (m (Graphene.Vec3.Vec3)), MonadIO m) => O.MethodInfo TriangleGetNormalMethodInfo Triangle signature where
    overloadedMethod = triangleGetNormal

#endif

-- method Triangle::get_plane
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "t"
--           , argType =
--               TInterface Name { namespace = "Graphene" , name = "Triangle" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #graphene_triangle_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 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_triangle_get_plane" graphene_triangle_get_plane :: 
    Ptr Triangle ->                         -- t : TInterface (Name {namespace = "Graphene", name = "Triangle"})
    Ptr Graphene.Plane.Plane ->             -- res : TInterface (Name {namespace = "Graphene", name = "Plane"})
    IO ()

-- | Computes the plane based on the vertices of the given t'GI.Graphene.Structs.Triangle.Triangle'.
-- 
-- /Since: 1.2/
triangleGetPlane ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Triangle
    -- ^ /@t@/: a t'GI.Graphene.Structs.Triangle.Triangle'
    -> m (Graphene.Plane.Plane)
triangleGetPlane :: Triangle -> m Plane
triangleGetPlane Triangle
t = 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 Triangle
t' <- Triangle -> IO (Ptr Triangle)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Triangle
t
    Ptr Plane
res <- Int -> IO (Ptr Plane)
forall a. GBoxed a => Int -> IO (Ptr a)
SP.callocBoxedBytes Int
20 :: IO (Ptr Graphene.Plane.Plane)
    Ptr Triangle -> Ptr Plane -> IO ()
graphene_triangle_get_plane Ptr Triangle
t' Ptr Plane
res
    Plane
res' <- ((ManagedPtr Plane -> Plane) -> Ptr Plane -> IO Plane
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Plane -> Plane
Graphene.Plane.Plane) Ptr Plane
res
    Triangle -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Triangle
t
    Plane -> IO Plane
forall (m :: * -> *) a. Monad m => a -> m a
return Plane
res'

#if defined(ENABLE_OVERLOADING)
data TriangleGetPlaneMethodInfo
instance (signature ~ (m (Graphene.Plane.Plane)), MonadIO m) => O.MethodInfo TriangleGetPlaneMethodInfo Triangle signature where
    overloadedMethod = triangleGetPlane

#endif

-- method Triangle::get_points
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "t"
--           , argType =
--               TInterface Name { namespace = "Graphene" , name = "Triangle" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #graphene_triangle_t"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "a"
--           , argType =
--               TInterface Name { namespace = "Graphene" , name = "Point3D" }
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "return location for the coordinates\n  of the first vertex"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = True
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "b"
--           , argType =
--               TInterface Name { namespace = "Graphene" , name = "Point3D" }
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "return location for the coordinates\n  of the second vertex"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = True
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "c"
--           , argType =
--               TInterface Name { namespace = "Graphene" , name = "Point3D" }
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "return location for the coordinates\n  of the third vertex"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = True
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "graphene_triangle_get_points" graphene_triangle_get_points :: 
    Ptr Triangle ->                         -- t : TInterface (Name {namespace = "Graphene", name = "Triangle"})
    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 ()

-- | Retrieves the three vertices of the given t'GI.Graphene.Structs.Triangle.Triangle' and returns
-- their coordinates as t'GI.Graphene.Structs.Point3D.Point3D'.
-- 
-- /Since: 1.2/
triangleGetPoints ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Triangle
    -- ^ /@t@/: a t'GI.Graphene.Structs.Triangle.Triangle'
    -> m ((Graphene.Point3D.Point3D, Graphene.Point3D.Point3D, Graphene.Point3D.Point3D))
triangleGetPoints :: Triangle -> m (Point3D, Point3D, Point3D)
triangleGetPoints Triangle
t = IO (Point3D, Point3D, Point3D) -> m (Point3D, Point3D, Point3D)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Point3D, Point3D, Point3D) -> m (Point3D, Point3D, Point3D))
-> IO (Point3D, Point3D, Point3D) -> m (Point3D, Point3D, Point3D)
forall a b. (a -> b) -> a -> b
$ do
    Ptr Triangle
t' <- Triangle -> IO (Ptr Triangle)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Triangle
t
    Ptr Point3D
a <- Int -> IO (Ptr Point3D)
forall a. GBoxed a => Int -> IO (Ptr a)
SP.callocBoxedBytes Int
12 :: IO (Ptr Graphene.Point3D.Point3D)
    Ptr Point3D
b <- Int -> IO (Ptr Point3D)
forall a. GBoxed a => Int -> IO (Ptr a)
SP.callocBoxedBytes Int
12 :: IO (Ptr Graphene.Point3D.Point3D)
    Ptr Point3D
c <- Int -> IO (Ptr Point3D)
forall a. GBoxed a => Int -> IO (Ptr a)
SP.callocBoxedBytes Int
12 :: IO (Ptr Graphene.Point3D.Point3D)
    Ptr Triangle -> Ptr Point3D -> Ptr Point3D -> Ptr Point3D -> IO ()
graphene_triangle_get_points Ptr Triangle
t' Ptr Point3D
a Ptr Point3D
b Ptr Point3D
c
    Point3D
a' <- ((ManagedPtr Point3D -> Point3D) -> Ptr Point3D -> IO Point3D
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Point3D -> Point3D
Graphene.Point3D.Point3D) Ptr Point3D
a
    Point3D
b' <- ((ManagedPtr Point3D -> Point3D) -> Ptr Point3D -> IO Point3D
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Point3D -> Point3D
Graphene.Point3D.Point3D) Ptr Point3D
b
    Point3D
c' <- ((ManagedPtr Point3D -> Point3D) -> Ptr Point3D -> IO Point3D
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Point3D -> Point3D
Graphene.Point3D.Point3D) Ptr Point3D
c
    Triangle -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Triangle
t
    (Point3D, Point3D, Point3D) -> IO (Point3D, Point3D, Point3D)
forall (m :: * -> *) a. Monad m => a -> m a
return (Point3D
a', Point3D
b', Point3D
c')

#if defined(ENABLE_OVERLOADING)
data TriangleGetPointsMethodInfo
instance (signature ~ (m ((Graphene.Point3D.Point3D, Graphene.Point3D.Point3D, Graphene.Point3D.Point3D))), MonadIO m) => O.MethodInfo TriangleGetPointsMethodInfo Triangle signature where
    overloadedMethod = triangleGetPoints

#endif

-- method Triangle::get_uv
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "t"
--           , argType =
--               TInterface Name { namespace = "Graphene" , name = "Triangle" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #graphene_triangle_t"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "p"
--           , argType =
--               TInterface Name { namespace = "Graphene" , name = "Point3D" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #graphene_point3d_t"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "uv_a"
--           , argType =
--               TInterface Name { namespace = "Graphene" , name = "Vec2" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the UV coordinates of the first point"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "uv_b"
--           , argType =
--               TInterface Name { namespace = "Graphene" , name = "Vec2" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the UV coordinates of the second point"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "uv_c"
--           , argType =
--               TInterface Name { namespace = "Graphene" , name = "Vec2" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the UV coordinates of the third point"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "res"
--           , argType =
--               TInterface Name { namespace = "Graphene" , name = "Vec2" }
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "a vector containing the UV coordinates\n  of the given point @p"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = True
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "graphene_triangle_get_uv" graphene_triangle_get_uv :: 
    Ptr Triangle ->                         -- t : TInterface (Name {namespace = "Graphene", name = "Triangle"})
    Ptr Graphene.Point3D.Point3D ->         -- p : TInterface (Name {namespace = "Graphene", name = "Point3D"})
    Ptr Graphene.Vec2.Vec2 ->               -- uv_a : TInterface (Name {namespace = "Graphene", name = "Vec2"})
    Ptr Graphene.Vec2.Vec2 ->               -- uv_b : TInterface (Name {namespace = "Graphene", name = "Vec2"})
    Ptr Graphene.Vec2.Vec2 ->               -- uv_c : TInterface (Name {namespace = "Graphene", name = "Vec2"})
    Ptr Graphene.Vec2.Vec2 ->               -- res : TInterface (Name {namespace = "Graphene", name = "Vec2"})
    IO CInt

-- | Computes the UV coordinates of the given point /@p@/.
-- 
-- The point /@p@/ must lie on the same plane as the triangle /@t@/; if the point
-- is not coplanar, the result of this function is undefined. If /@p@/ is 'P.Nothing',
-- the point will be set in (0, 0, 0).
-- 
-- The UV coordinates will be placed in the /@res@/ vector:
-- 
--  - @res.x = u@
--  - @res.y = v@
-- 
-- See also: 'GI.Graphene.Structs.Triangle.triangleGetBarycoords'
-- 
-- /Since: 1.10/
triangleGetUv ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Triangle
    -- ^ /@t@/: a t'GI.Graphene.Structs.Triangle.Triangle'
    -> Maybe (Graphene.Point3D.Point3D)
    -- ^ /@p@/: a t'GI.Graphene.Structs.Point3D.Point3D'
    -> Graphene.Vec2.Vec2
    -- ^ /@uvA@/: the UV coordinates of the first point
    -> Graphene.Vec2.Vec2
    -- ^ /@uvB@/: the UV coordinates of the second point
    -> Graphene.Vec2.Vec2
    -- ^ /@uvC@/: the UV coordinates of the third point
    -> m ((Bool, Graphene.Vec2.Vec2))
    -- ^ __Returns:__ @true@ if the coordinates are valid
triangleGetUv :: Triangle -> Maybe Point3D -> Vec2 -> Vec2 -> Vec2 -> m (Bool, Vec2)
triangleGetUv Triangle
t Maybe Point3D
p Vec2
uvA Vec2
uvB Vec2
uvC = IO (Bool, Vec2) -> m (Bool, Vec2)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Bool, Vec2) -> m (Bool, Vec2))
-> IO (Bool, Vec2) -> m (Bool, Vec2)
forall a b. (a -> b) -> a -> b
$ do
    Ptr Triangle
t' <- Triangle -> IO (Ptr Triangle)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Triangle
t
    Ptr Point3D
maybeP <- case Maybe Point3D
p of
        Maybe Point3D
Nothing -> Ptr Point3D -> IO (Ptr Point3D)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Point3D
forall a. Ptr a
nullPtr
        Just Point3D
jP -> do
            Ptr Point3D
jP' <- Point3D -> IO (Ptr Point3D)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Point3D
jP
            Ptr Point3D -> IO (Ptr Point3D)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Point3D
jP'
    Ptr Vec2
uvA' <- Vec2 -> IO (Ptr Vec2)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Vec2
uvA
    Ptr Vec2
uvB' <- Vec2 -> IO (Ptr Vec2)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Vec2
uvB
    Ptr Vec2
uvC' <- Vec2 -> IO (Ptr Vec2)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Vec2
uvC
    Ptr Vec2
res <- Int -> IO (Ptr Vec2)
forall a. GBoxed a => Int -> IO (Ptr a)
SP.callocBoxedBytes Int
16 :: IO (Ptr Graphene.Vec2.Vec2)
    CInt
result <- Ptr Triangle
-> Ptr Point3D
-> Ptr Vec2
-> Ptr Vec2
-> Ptr Vec2
-> Ptr Vec2
-> IO CInt
graphene_triangle_get_uv Ptr Triangle
t' Ptr Point3D
maybeP Ptr Vec2
uvA' Ptr Vec2
uvB' Ptr Vec2
uvC' Ptr Vec2
res
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    Vec2
res' <- ((ManagedPtr Vec2 -> Vec2) -> Ptr Vec2 -> IO Vec2
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Vec2 -> Vec2
Graphene.Vec2.Vec2) Ptr Vec2
res
    Triangle -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Triangle
t
    Maybe Point3D -> (Point3D -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe Point3D
p Point3D -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
    Vec2 -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Vec2
uvA
    Vec2 -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Vec2
uvB
    Vec2 -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Vec2
uvC
    (Bool, Vec2) -> IO (Bool, Vec2)
forall (m :: * -> *) a. Monad m => a -> m a
return (Bool
result', Vec2
res')

#if defined(ENABLE_OVERLOADING)
data TriangleGetUvMethodInfo
instance (signature ~ (Maybe (Graphene.Point3D.Point3D) -> Graphene.Vec2.Vec2 -> Graphene.Vec2.Vec2 -> Graphene.Vec2.Vec2 -> m ((Bool, Graphene.Vec2.Vec2))), MonadIO m) => O.MethodInfo TriangleGetUvMethodInfo Triangle signature where
    overloadedMethod = triangleGetUv

#endif

-- method Triangle::get_vertices
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "t"
--           , argType =
--               TInterface Name { namespace = "Graphene" , name = "Triangle" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #graphene_triangle_t"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "a"
--           , argType =
--               TInterface Name { namespace = "Graphene" , name = "Vec3" }
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "return location for the first vertex"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = True
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "b"
--           , argType =
--               TInterface Name { namespace = "Graphene" , name = "Vec3" }
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "return location for the second vertex"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = True
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "c"
--           , argType =
--               TInterface Name { namespace = "Graphene" , name = "Vec3" }
--           , direction = DirectionOut
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "return location for the third vertex"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = True
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "graphene_triangle_get_vertices" graphene_triangle_get_vertices :: 
    Ptr Triangle ->                         -- t : TInterface (Name {namespace = "Graphene", name = "Triangle"})
    Ptr Graphene.Vec3.Vec3 ->               -- a : TInterface (Name {namespace = "Graphene", name = "Vec3"})
    Ptr Graphene.Vec3.Vec3 ->               -- b : TInterface (Name {namespace = "Graphene", name = "Vec3"})
    Ptr Graphene.Vec3.Vec3 ->               -- c : TInterface (Name {namespace = "Graphene", name = "Vec3"})
    IO ()

-- | Retrieves the three vertices of the given t'GI.Graphene.Structs.Triangle.Triangle'.
-- 
-- /Since: 1.2/
triangleGetVertices ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Triangle
    -- ^ /@t@/: a t'GI.Graphene.Structs.Triangle.Triangle'
    -> m ((Graphene.Vec3.Vec3, Graphene.Vec3.Vec3, Graphene.Vec3.Vec3))
triangleGetVertices :: Triangle -> m (Vec3, Vec3, Vec3)
triangleGetVertices Triangle
t = IO (Vec3, Vec3, Vec3) -> m (Vec3, Vec3, Vec3)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Vec3, Vec3, Vec3) -> m (Vec3, Vec3, Vec3))
-> IO (Vec3, Vec3, Vec3) -> m (Vec3, Vec3, Vec3)
forall a b. (a -> b) -> a -> b
$ do
    Ptr Triangle
t' <- Triangle -> IO (Ptr Triangle)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Triangle
t
    Ptr Vec3
a <- Int -> IO (Ptr Vec3)
forall a. GBoxed a => Int -> IO (Ptr a)
SP.callocBoxedBytes Int
16 :: IO (Ptr Graphene.Vec3.Vec3)
    Ptr Vec3
b <- Int -> IO (Ptr Vec3)
forall a. GBoxed a => Int -> IO (Ptr a)
SP.callocBoxedBytes Int
16 :: IO (Ptr Graphene.Vec3.Vec3)
    Ptr Vec3
c <- Int -> IO (Ptr Vec3)
forall a. GBoxed a => Int -> IO (Ptr a)
SP.callocBoxedBytes Int
16 :: IO (Ptr Graphene.Vec3.Vec3)
    Ptr Triangle -> Ptr Vec3 -> Ptr Vec3 -> Ptr Vec3 -> IO ()
graphene_triangle_get_vertices Ptr Triangle
t' Ptr Vec3
a Ptr Vec3
b Ptr Vec3
c
    Vec3
a' <- ((ManagedPtr Vec3 -> Vec3) -> Ptr Vec3 -> IO Vec3
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Vec3 -> Vec3
Graphene.Vec3.Vec3) Ptr Vec3
a
    Vec3
b' <- ((ManagedPtr Vec3 -> Vec3) -> Ptr Vec3 -> IO Vec3
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Vec3 -> Vec3
Graphene.Vec3.Vec3) Ptr Vec3
b
    Vec3
c' <- ((ManagedPtr Vec3 -> Vec3) -> Ptr Vec3 -> IO Vec3
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Vec3 -> Vec3
Graphene.Vec3.Vec3) Ptr Vec3
c
    Triangle -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Triangle
t
    (Vec3, Vec3, Vec3) -> IO (Vec3, Vec3, Vec3)
forall (m :: * -> *) a. Monad m => a -> m a
return (Vec3
a', Vec3
b', Vec3
c')

#if defined(ENABLE_OVERLOADING)
data TriangleGetVerticesMethodInfo
instance (signature ~ (m ((Graphene.Vec3.Vec3, Graphene.Vec3.Vec3, Graphene.Vec3.Vec3))), MonadIO m) => O.MethodInfo TriangleGetVerticesMethodInfo Triangle signature where
    overloadedMethod = triangleGetVertices

#endif

-- method Triangle::init_from_float
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "t"
--           , argType =
--               TInterface Name { namespace = "Graphene" , name = "Triangle" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the #graphene_triangle_t to initialize"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "a"
--           , argType = TCArray False 3 (-1) (TBasicType TFloat)
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "an array of 3 floating point values"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "b"
--           , argType = TCArray False 3 (-1) (TBasicType TFloat)
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "an array of 3 floating point values"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "c"
--           , argType = TCArray False 3 (-1) (TBasicType TFloat)
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "an array of 3 floating point values"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just
--               (TInterface Name { namespace = "Graphene" , name = "Triangle" })
-- throws : False
-- Skip return : False

foreign import ccall "graphene_triangle_init_from_float" graphene_triangle_init_from_float :: 
    Ptr Triangle ->                         -- t : TInterface (Name {namespace = "Graphene", name = "Triangle"})
    Ptr CFloat ->                           -- a : TCArray False 3 (-1) (TBasicType TFloat)
    Ptr CFloat ->                           -- b : TCArray False 3 (-1) (TBasicType TFloat)
    Ptr CFloat ->                           -- c : TCArray False 3 (-1) (TBasicType TFloat)
    IO (Ptr Triangle)

-- | Initializes a t'GI.Graphene.Structs.Triangle.Triangle' using the three given arrays
-- of floating point values, each representing the coordinates of
-- a point in 3D space.
-- 
-- /Since: 1.10/
triangleInitFromFloat ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Triangle
    -- ^ /@t@/: the t'GI.Graphene.Structs.Triangle.Triangle' to initialize
    -> [Float]
    -- ^ /@a@/: an array of 3 floating point values
    -> [Float]
    -- ^ /@b@/: an array of 3 floating point values
    -> [Float]
    -- ^ /@c@/: an array of 3 floating point values
    -> m Triangle
    -- ^ __Returns:__ the initialized t'GI.Graphene.Structs.Triangle.Triangle'
triangleInitFromFloat :: Triangle -> [Float] -> [Float] -> [Float] -> m Triangle
triangleInitFromFloat Triangle
t [Float]
a [Float]
b [Float]
c = IO Triangle -> m Triangle
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Triangle -> m Triangle) -> IO Triangle -> m Triangle
forall a b. (a -> b) -> a -> b
$ do
    Ptr Triangle
t' <- Triangle -> IO (Ptr Triangle)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Triangle
t
    Ptr CFloat
a' <- ((Float -> CFloat) -> [Float] -> IO (Ptr CFloat)
forall a b. Storable b => (a -> b) -> [a] -> IO (Ptr b)
packMapStorableArray Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac) [Float]
a
    Ptr CFloat
b' <- ((Float -> CFloat) -> [Float] -> IO (Ptr CFloat)
forall a b. Storable b => (a -> b) -> [a] -> IO (Ptr b)
packMapStorableArray Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac) [Float]
b
    Ptr CFloat
c' <- ((Float -> CFloat) -> [Float] -> IO (Ptr CFloat)
forall a b. Storable b => (a -> b) -> [a] -> IO (Ptr b)
packMapStorableArray Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac) [Float]
c
    Ptr Triangle
result <- Ptr Triangle
-> Ptr CFloat -> Ptr CFloat -> Ptr CFloat -> IO (Ptr Triangle)
graphene_triangle_init_from_float Ptr Triangle
t' Ptr CFloat
a' Ptr CFloat
b' Ptr CFloat
c'
    Text -> Ptr Triangle -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"triangleInitFromFloat" Ptr Triangle
result
    Triangle
result' <- ((ManagedPtr Triangle -> Triangle) -> Ptr Triangle -> IO Triangle
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newBoxed ManagedPtr Triangle -> Triangle
Triangle) Ptr Triangle
result
    Triangle -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Triangle
t
    Ptr CFloat -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CFloat
a'
    Ptr CFloat -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CFloat
b'
    Ptr CFloat -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CFloat
c'
    Triangle -> IO Triangle
forall (m :: * -> *) a. Monad m => a -> m a
return Triangle
result'

#if defined(ENABLE_OVERLOADING)
data TriangleInitFromFloatMethodInfo
instance (signature ~ ([Float] -> [Float] -> [Float] -> m Triangle), MonadIO m) => O.MethodInfo TriangleInitFromFloatMethodInfo Triangle signature where
    overloadedMethod = triangleInitFromFloat

#endif

-- method Triangle::init_from_point3d
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "t"
--           , argType =
--               TInterface Name { namespace = "Graphene" , name = "Triangle" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the #graphene_triangle_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 = True
--           , 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 = True
--           , 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 = True
--           , 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 = "Triangle" })
-- throws : False
-- Skip return : False

foreign import ccall "graphene_triangle_init_from_point3d" graphene_triangle_init_from_point3d :: 
    Ptr Triangle ->                         -- t : TInterface (Name {namespace = "Graphene", name = "Triangle"})
    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 Triangle)

-- | Initializes a t'GI.Graphene.Structs.Triangle.Triangle' using the three given 3D points.
-- 
-- /Since: 1.2/
triangleInitFromPoint3d ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Triangle
    -- ^ /@t@/: the t'GI.Graphene.Structs.Triangle.Triangle' to initialize
    -> Maybe (Graphene.Point3D.Point3D)
    -- ^ /@a@/: a t'GI.Graphene.Structs.Point3D.Point3D'
    -> Maybe (Graphene.Point3D.Point3D)
    -- ^ /@b@/: a t'GI.Graphene.Structs.Point3D.Point3D'
    -> Maybe (Graphene.Point3D.Point3D)
    -- ^ /@c@/: a t'GI.Graphene.Structs.Point3D.Point3D'
    -> m Triangle
    -- ^ __Returns:__ the initialized t'GI.Graphene.Structs.Triangle.Triangle'
triangleInitFromPoint3d :: Triangle
-> Maybe Point3D -> Maybe Point3D -> Maybe Point3D -> m Triangle
triangleInitFromPoint3d Triangle
t Maybe Point3D
a Maybe Point3D
b Maybe Point3D
c = IO Triangle -> m Triangle
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Triangle -> m Triangle) -> IO Triangle -> m Triangle
forall a b. (a -> b) -> a -> b
$ do
    Ptr Triangle
t' <- Triangle -> IO (Ptr Triangle)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Triangle
t
    Ptr Point3D
maybeA <- case Maybe Point3D
a of
        Maybe Point3D
Nothing -> Ptr Point3D -> IO (Ptr Point3D)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Point3D
forall a. Ptr a
nullPtr
        Just Point3D
jA -> do
            Ptr Point3D
jA' <- Point3D -> IO (Ptr Point3D)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Point3D
jA
            Ptr Point3D -> IO (Ptr Point3D)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Point3D
jA'
    Ptr Point3D
maybeB <- case Maybe Point3D
b of
        Maybe Point3D
Nothing -> Ptr Point3D -> IO (Ptr Point3D)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Point3D
forall a. Ptr a
nullPtr
        Just Point3D
jB -> do
            Ptr Point3D
jB' <- Point3D -> IO (Ptr Point3D)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Point3D
jB
            Ptr Point3D -> IO (Ptr Point3D)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Point3D
jB'
    Ptr Point3D
maybeC <- case Maybe Point3D
c of
        Maybe Point3D
Nothing -> Ptr Point3D -> IO (Ptr Point3D)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Point3D
forall a. Ptr a
nullPtr
        Just Point3D
jC -> do
            Ptr Point3D
jC' <- Point3D -> IO (Ptr Point3D)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Point3D
jC
            Ptr Point3D -> IO (Ptr Point3D)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Point3D
jC'
    Ptr Triangle
result <- Ptr Triangle
-> Ptr Point3D -> Ptr Point3D -> Ptr Point3D -> IO (Ptr Triangle)
graphene_triangle_init_from_point3d Ptr Triangle
t' Ptr Point3D
maybeA Ptr Point3D
maybeB Ptr Point3D
maybeC
    Text -> Ptr Triangle -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"triangleInitFromPoint3d" Ptr Triangle
result
    Triangle
result' <- ((ManagedPtr Triangle -> Triangle) -> Ptr Triangle -> IO Triangle
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newBoxed ManagedPtr Triangle -> Triangle
Triangle) Ptr Triangle
result
    Triangle -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Triangle
t
    Maybe Point3D -> (Point3D -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe Point3D
a Point3D -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
    Maybe Point3D -> (Point3D -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe Point3D
b Point3D -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
    Maybe Point3D -> (Point3D -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe Point3D
c Point3D -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
    Triangle -> IO Triangle
forall (m :: * -> *) a. Monad m => a -> m a
return Triangle
result'

#if defined(ENABLE_OVERLOADING)
data TriangleInitFromPoint3dMethodInfo
instance (signature ~ (Maybe (Graphene.Point3D.Point3D) -> Maybe (Graphene.Point3D.Point3D) -> Maybe (Graphene.Point3D.Point3D) -> m Triangle), MonadIO m) => O.MethodInfo TriangleInitFromPoint3dMethodInfo Triangle signature where
    overloadedMethod = triangleInitFromPoint3d

#endif

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

foreign import ccall "graphene_triangle_init_from_vec3" graphene_triangle_init_from_vec3 :: 
    Ptr Triangle ->                         -- t : TInterface (Name {namespace = "Graphene", name = "Triangle"})
    Ptr Graphene.Vec3.Vec3 ->               -- a : TInterface (Name {namespace = "Graphene", name = "Vec3"})
    Ptr Graphene.Vec3.Vec3 ->               -- b : TInterface (Name {namespace = "Graphene", name = "Vec3"})
    Ptr Graphene.Vec3.Vec3 ->               -- c : TInterface (Name {namespace = "Graphene", name = "Vec3"})
    IO (Ptr Triangle)

-- | Initializes a t'GI.Graphene.Structs.Triangle.Triangle' using the three given vectors.
-- 
-- /Since: 1.2/
triangleInitFromVec3 ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Triangle
    -- ^ /@t@/: the t'GI.Graphene.Structs.Triangle.Triangle' to initialize
    -> Maybe (Graphene.Vec3.Vec3)
    -- ^ /@a@/: a t'GI.Graphene.Structs.Vec3.Vec3'
    -> Maybe (Graphene.Vec3.Vec3)
    -- ^ /@b@/: a t'GI.Graphene.Structs.Vec3.Vec3'
    -> Maybe (Graphene.Vec3.Vec3)
    -- ^ /@c@/: a t'GI.Graphene.Structs.Vec3.Vec3'
    -> m Triangle
    -- ^ __Returns:__ the initialized t'GI.Graphene.Structs.Triangle.Triangle'
triangleInitFromVec3 :: Triangle -> Maybe Vec3 -> Maybe Vec3 -> Maybe Vec3 -> m Triangle
triangleInitFromVec3 Triangle
t Maybe Vec3
a Maybe Vec3
b Maybe Vec3
c = IO Triangle -> m Triangle
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Triangle -> m Triangle) -> IO Triangle -> m Triangle
forall a b. (a -> b) -> a -> b
$ do
    Ptr Triangle
t' <- Triangle -> IO (Ptr Triangle)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Triangle
t
    Ptr Vec3
maybeA <- case Maybe Vec3
a of
        Maybe Vec3
Nothing -> Ptr Vec3 -> IO (Ptr Vec3)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Vec3
forall a. Ptr a
nullPtr
        Just Vec3
jA -> do
            Ptr Vec3
jA' <- Vec3 -> IO (Ptr Vec3)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Vec3
jA
            Ptr Vec3 -> IO (Ptr Vec3)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Vec3
jA'
    Ptr Vec3
maybeB <- case Maybe Vec3
b of
        Maybe Vec3
Nothing -> Ptr Vec3 -> IO (Ptr Vec3)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Vec3
forall a. Ptr a
nullPtr
        Just Vec3
jB -> do
            Ptr Vec3
jB' <- Vec3 -> IO (Ptr Vec3)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Vec3
jB
            Ptr Vec3 -> IO (Ptr Vec3)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Vec3
jB'
    Ptr Vec3
maybeC <- case Maybe Vec3
c of
        Maybe Vec3
Nothing -> Ptr Vec3 -> IO (Ptr Vec3)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Vec3
forall a. Ptr a
nullPtr
        Just Vec3
jC -> do
            Ptr Vec3
jC' <- Vec3 -> IO (Ptr Vec3)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Vec3
jC
            Ptr Vec3 -> IO (Ptr Vec3)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Vec3
jC'
    Ptr Triangle
result <- Ptr Triangle
-> Ptr Vec3 -> Ptr Vec3 -> Ptr Vec3 -> IO (Ptr Triangle)
graphene_triangle_init_from_vec3 Ptr Triangle
t' Ptr Vec3
maybeA Ptr Vec3
maybeB Ptr Vec3
maybeC
    Text -> Ptr Triangle -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"triangleInitFromVec3" Ptr Triangle
result
    Triangle
result' <- ((ManagedPtr Triangle -> Triangle) -> Ptr Triangle -> IO Triangle
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newBoxed ManagedPtr Triangle -> Triangle
Triangle) Ptr Triangle
result
    Triangle -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Triangle
t
    Maybe Vec3 -> (Vec3 -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe Vec3
a Vec3 -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
    Maybe Vec3 -> (Vec3 -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe Vec3
b Vec3 -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
    Maybe Vec3 -> (Vec3 -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe Vec3
c Vec3 -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
    Triangle -> IO Triangle
forall (m :: * -> *) a. Monad m => a -> m a
return Triangle
result'

#if defined(ENABLE_OVERLOADING)
data TriangleInitFromVec3MethodInfo
instance (signature ~ (Maybe (Graphene.Vec3.Vec3) -> Maybe (Graphene.Vec3.Vec3) -> Maybe (Graphene.Vec3.Vec3) -> m Triangle), MonadIO m) => O.MethodInfo TriangleInitFromVec3MethodInfo Triangle signature where
    overloadedMethod = triangleInitFromVec3

#endif

#if defined(ENABLE_OVERLOADING)
type family ResolveTriangleMethod (t :: Symbol) (o :: *) :: * where
    ResolveTriangleMethod "containsPoint" o = TriangleContainsPointMethodInfo
    ResolveTriangleMethod "equal" o = TriangleEqualMethodInfo
    ResolveTriangleMethod "free" o = TriangleFreeMethodInfo
    ResolveTriangleMethod "initFromFloat" o = TriangleInitFromFloatMethodInfo
    ResolveTriangleMethod "initFromPoint3d" o = TriangleInitFromPoint3dMethodInfo
    ResolveTriangleMethod "initFromVec3" o = TriangleInitFromVec3MethodInfo
    ResolveTriangleMethod "getArea" o = TriangleGetAreaMethodInfo
    ResolveTriangleMethod "getBarycoords" o = TriangleGetBarycoordsMethodInfo
    ResolveTriangleMethod "getBoundingBox" o = TriangleGetBoundingBoxMethodInfo
    ResolveTriangleMethod "getMidpoint" o = TriangleGetMidpointMethodInfo
    ResolveTriangleMethod "getNormal" o = TriangleGetNormalMethodInfo
    ResolveTriangleMethod "getPlane" o = TriangleGetPlaneMethodInfo
    ResolveTriangleMethod "getPoints" o = TriangleGetPointsMethodInfo
    ResolveTriangleMethod "getUv" o = TriangleGetUvMethodInfo
    ResolveTriangleMethod "getVertices" o = TriangleGetVerticesMethodInfo
    ResolveTriangleMethod l o = O.MethodResolutionFailed l o

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

#endif