Copyright | Will Thompson Iñaki García Etxebarria and Jonas Platte |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | None |
Language | Haskell2010 |
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 # | |
IsGValue Triangle Source # | Convert |
ManagedPtrNewtype Triangle Source # | |
Defined in GI.Graphene.Structs.Triangle toManagedPtr :: Triangle -> ManagedPtr Triangle # | |
TypedObject Triangle Source # | |
Defined in GI.Graphene.Structs.Triangle | |
GBoxed Triangle Source # | |
Defined in GI.Graphene.Structs.Triangle | |
HasParentTypes Triangle Source # | |
Defined in GI.Graphene.Structs.Triangle | |
tag ~ 'AttrSet => Constructible Triangle tag Source # | |
Defined in GI.Graphene.Structs.Triangle | |
type ParentTypes Triangle Source # | |
Defined in GI.Graphene.Structs.Triangle |
Methods
Overloaded methods
alloc
:: (HasCallStack, MonadIO m) | |
=> m Triangle | Returns: the newly allocated |
containsPoint
triangleContainsPoint Source #
:: (HasCallStack, MonadIO m) | |
=> Triangle |
|
-> Point3D |
|
-> m Bool | Returns: |
Checks whether the given triangle t
contains the point p
.
Since: 1.2
equal
:: (HasCallStack, MonadIO m) | |
=> Triangle |
|
-> Triangle |
|
-> m Bool | Returns: |
Checks whether the two given Triangle
are equal.
Since: 1.2
free
:: (HasCallStack, MonadIO m) | |
=> Triangle |
|
-> m () |
Frees the resources allocated by triangleAlloc
.
Since: 1.2
getArea
:: (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 #
:: (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 #
:: (HasCallStack, MonadIO m) | |
=> Triangle |
|
-> m Box |
Computes the bounding box of the given Triangle
.
Since: 1.2
getMidpoint
:: (HasCallStack, MonadIO m) | |
=> Triangle |
|
-> m Point3D |
getNormal
:: (HasCallStack, MonadIO m) | |
=> Triangle |
|
-> m Vec3 |
Computes the normal vector of the given Triangle
.
Since: 1.2
getPlane
:: (HasCallStack, MonadIO m) | |
=> Triangle |
|
-> m Plane |
Computes the plane based on the vertices of the given Triangle
.
Since: 1.2
getPoints
getUv
:: (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 #
:: (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 #
:: (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