gi-graphene-1.0.2: Graphene bindings
CopyrightWill Thompson Iñaki García Etxebarria and Jonas Platte
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellNone
LanguageHaskell2010

GI.Graphene.Structs.Triangle

Description

A triangle.

Since: 1.2

Synopsis

Exported types

newtype Triangle Source #

Memory-managed wrapper type.

Constructors

Triangle (ManagedPtr Triangle) 

Instances

Instances details
Eq Triangle Source # 
Instance details

Defined in GI.Graphene.Structs.Triangle

IsGValue Triangle Source #

Convert Triangle to and from GValue with toGValue and fromGValue.

Instance details

Defined in GI.Graphene.Structs.Triangle

ManagedPtrNewtype Triangle Source # 
Instance details

Defined in GI.Graphene.Structs.Triangle

TypedObject Triangle Source # 
Instance details

Defined in GI.Graphene.Structs.Triangle

Methods

glibType :: IO GType #

GBoxed Triangle Source # 
Instance details

Defined in GI.Graphene.Structs.Triangle

HasParentTypes Triangle Source # 
Instance details

Defined in GI.Graphene.Structs.Triangle

tag ~ 'AttrSet => Constructible Triangle tag Source # 
Instance details

Defined in GI.Graphene.Structs.Triangle

Methods

new :: MonadIO m => (ManagedPtr Triangle -> Triangle) -> [AttrOp Triangle tag] -> m Triangle #

type ParentTypes Triangle Source # 
Instance details

Defined in GI.Graphene.Structs.Triangle

type ParentTypes Triangle = '[] :: [Type]

newZeroTriangle :: MonadIO m => m Triangle Source #

Construct a Triangle struct initialized to zero.

Methods

Overloaded methods

alloc

triangleAlloc Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> m Triangle

Returns: the newly allocated Triangle structure. Use triangleFree to free the resources allocated by this function

Allocates a new Triangle.

The contents of the returned structure are undefined.

Since: 1.2

containsPoint

triangleContainsPoint Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Triangle

t: a Triangle

-> Point3D

p: a Point3D

-> m Bool

Returns: true if the point is inside the triangle

Checks whether the given triangle t contains the point p.

Since: 1.2

equal

triangleEqual Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Triangle

a: a Triangle

-> Triangle

b: a Triangle

-> m Bool

Returns: true if the triangles are equal

Checks whether the two given Triangle are equal.

Since: 1.2

free

triangleFree Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Triangle

t: a Triangle

-> m () 

Frees the resources allocated by triangleAlloc.

Since: 1.2

getArea

triangleGetArea Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Triangle

t: a 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

t: a Triangle

-> Maybe Point3D

p: a Point3D

-> m (Bool, Vec2)

Returns: true if the barycentric coordinates are valid

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

t: a Triangle

-> m Box 

Computes the bounding box of the given Triangle.

Since: 1.2

getMidpoint

triangleGetMidpoint Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Triangle

t: a Triangle

-> m Point3D 

Computes the coordinates of the midpoint of the given Triangle.

The midpoint G is the centroid of the triangle, i.e. the intersection of its medians.

Since: 1.2

getNormal

triangleGetNormal Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Triangle

t: a Triangle

-> m Vec3 

Computes the normal vector of the given Triangle.

Since: 1.2

getPlane

triangleGetPlane Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Triangle

t: a Triangle

-> m Plane 

Computes the plane based on the vertices of the given Triangle.

Since: 1.2

getPoints

triangleGetPoints Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Triangle

t: a Triangle

-> m (Point3D, Point3D, Point3D) 

Retrieves the three vertices of the given Triangle and returns their coordinates as Point3D.

Since: 1.2

getUv

triangleGetUv Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Triangle

t: a Triangle

-> Maybe Point3D

p: a Point3D

-> Vec2

uvA: the UV coordinates of the first point

-> Vec2

uvB: the UV coordinates of the second point

-> Vec2

uvC: the UV coordinates of the third point

-> m (Bool, Vec2)

Returns: true if the coordinates are valid

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

triangleGetVertices Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Triangle

t: a Triangle

-> m (Vec3, Vec3, Vec3) 

Retrieves the three vertices of the given Triangle.

Since: 1.2

initFromFloat

triangleInitFromFloat Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Triangle

t: the 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 Triangle

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

t: the Triangle to initialize

-> Maybe Point3D

a: a Point3D

-> Maybe Point3D

b: a Point3D

-> Maybe Point3D

c: a Point3D

-> m Triangle

Returns: the initialized Triangle

Initializes a Triangle using the three given 3D points.

Since: 1.2

initFromVec3

triangleInitFromVec3 Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Triangle

t: the Triangle to initialize

-> Maybe Vec3

a: a Vec3

-> Maybe Vec3

b: a Vec3

-> Maybe Vec3

c: a Vec3

-> m Triangle

Returns: the initialized Triangle

Initializes a Triangle using the three given vectors.

Since: 1.2