Copyright | Will Thompson and Iñaki García Etxebarria |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
GI.Graphene.Structs.Triangle
Description
A triangle.
Since: 1.2
Synopsis
- newtype Triangle = Triangle (ManagedPtr Triangle)
- newZeroTriangle :: MonadIO m => m Triangle
- triangleAlloc :: (HasCallStack, MonadIO m) => m Triangle
- triangleContainsPoint :: (HasCallStack, MonadIO m) => Triangle -> Point3D -> m Bool
- triangleEqual :: (HasCallStack, MonadIO m) => Triangle -> Triangle -> m Bool
- triangleFree :: (HasCallStack, MonadIO m) => Triangle -> m ()
- triangleGetArea :: (HasCallStack, MonadIO m) => Triangle -> m Float
- triangleGetBarycoords :: (HasCallStack, MonadIO m) => Triangle -> Maybe Point3D -> m (Bool, Vec2)
- triangleGetBoundingBox :: (HasCallStack, MonadIO m) => Triangle -> m Box
- triangleGetMidpoint :: (HasCallStack, MonadIO m) => Triangle -> m Point3D
- triangleGetNormal :: (HasCallStack, MonadIO m) => Triangle -> m Vec3
- triangleGetPlane :: (HasCallStack, MonadIO m) => Triangle -> m Plane
- triangleGetPoints :: (HasCallStack, MonadIO m) => Triangle -> m (Point3D, Point3D, Point3D)
- triangleGetUv :: (HasCallStack, MonadIO m) => Triangle -> Maybe Point3D -> Vec2 -> Vec2 -> Vec2 -> m (Bool, Vec2)
- triangleGetVertices :: (HasCallStack, MonadIO m) => Triangle -> m (Vec3, Vec3, Vec3)
- triangleInitFromFloat :: (HasCallStack, MonadIO m) => Triangle -> [Float] -> [Float] -> [Float] -> m Triangle
- triangleInitFromPoint3d :: (HasCallStack, MonadIO m) => Triangle -> Maybe Point3D -> Maybe Point3D -> Maybe Point3D -> m Triangle
- triangleInitFromVec3 :: (HasCallStack, MonadIO m) => Triangle -> Maybe Vec3 -> Maybe Vec3 -> Maybe Vec3 -> m Triangle
Exported types
Memory-managed wrapper type.
Instances
Eq Triangle Source # | |
GBoxed Triangle Source # | |
Defined in GI.Graphene.Structs.Triangle | |
ManagedPtrNewtype Triangle Source # | |
Defined in GI.Graphene.Structs.Triangle Methods toManagedPtr :: Triangle -> ManagedPtr Triangle | |
TypedObject Triangle Source # | |
Defined in GI.Graphene.Structs.Triangle | |
HasParentTypes Triangle Source # | |
Defined in GI.Graphene.Structs.Triangle | |
tag ~ 'AttrSet => Constructible Triangle tag Source # | |
IsGValue (Maybe Triangle) Source # | Convert |
Defined in GI.Graphene.Structs.Triangle Methods gvalueGType_ :: IO GType gvalueSet_ :: Ptr GValue -> Maybe Triangle -> IO () gvalueGet_ :: Ptr GValue -> IO (Maybe Triangle) | |
type ParentTypes Triangle Source # | |
Defined in GI.Graphene.Structs.Triangle |
Methods
Click to display all available methods, including inherited ones
Methods
containsPoint, equal, free, initFromFloat, initFromPoint3d, initFromVec3.
Getters
getArea, getBarycoords, getBoundingBox, getMidpoint, getNormal, getPlane, getPoints, getUv, getVertices.
Setters
None.
alloc
Arguments
:: (HasCallStack, MonadIO m) | |
=> m Triangle | Returns: the newly allocated |
containsPoint
triangleContainsPoint Source #
Arguments
:: (HasCallStack, MonadIO m) | |
=> Triangle |
|
-> Point3D |
|
-> m Bool | Returns: |
Checks whether the given triangle t
contains the point p
.
Since: 1.2
equal
Arguments
:: (HasCallStack, MonadIO m) | |
=> Triangle |
|
-> Triangle |
|
-> m Bool | Returns: |
Checks whether the two given Triangle
are equal.
Since: 1.2
free
Arguments
:: (HasCallStack, MonadIO m) | |
=> Triangle |
|
-> m () |
Frees the resources allocated by triangleAlloc
.
Since: 1.2
getArea
Arguments
:: (HasCallStack, MonadIO m) | |
=> Triangle |
|
-> m Float | Returns: the area of the triangle |
Computes the area of the given Triangle
.
Since: 1.2
getBarycoords
triangleGetBarycoords Source #
Arguments
:: (HasCallStack, MonadIO m) | |
=> Triangle |
|
-> Maybe Point3D |
|
-> m (Bool, Vec2) | Returns: |
Computes the 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:
The returned Vec2
contains the following values, in order:
res.x = u
res.y = v
Since: 1.2
getBoundingBox
triangleGetBoundingBox Source #
Arguments
:: (HasCallStack, MonadIO m) | |
=> Triangle |
|
-> m Box |
Computes the bounding box of the given Triangle
.
Since: 1.2
getMidpoint
Arguments
:: (HasCallStack, MonadIO m) | |
=> Triangle |
|
-> m Point3D |
getNormal
Arguments
:: (HasCallStack, MonadIO m) | |
=> Triangle |
|
-> m Vec3 |
Computes the normal vector of the given Triangle
.
Since: 1.2
getPlane
Arguments
:: (HasCallStack, MonadIO m) | |
=> Triangle |
|
-> m Plane |
Computes the plane based on the vertices of the given Triangle
.
Since: 1.2
getPoints
getUv
Arguments
:: (HasCallStack, MonadIO m) | |
=> Triangle |
|
-> Maybe Point3D |
|
-> Vec2 |
|
-> Vec2 |
|
-> Vec2 |
|
-> m (Bool, Vec2) | Returns: |
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 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: triangleGetBarycoords
Since: 1.10
getVertices
Retrieves the three vertices of the given Triangle
.
Since: 1.2
initFromFloat
triangleInitFromFloat Source #
Arguments
:: (HasCallStack, MonadIO m) | |
=> Triangle |
|
-> [Float] |
|
-> [Float] |
|
-> [Float] |
|
-> m Triangle | Returns: the initialized |
Initializes a Triangle
using the three given arrays
of floating point values, each representing the coordinates of
a point in 3D space.
Since: 1.10
initFromPoint3d
triangleInitFromPoint3d Source #
Arguments
:: (HasCallStack, MonadIO m) | |
=> Triangle |
|
-> Maybe Point3D |
|
-> Maybe Point3D |
|
-> Maybe Point3D |
|
-> m Triangle | Returns: the initialized |
Initializes a Triangle
using the three given 3D points.
Since: 1.2