gi-graphene-1.0.8: Graphene bindings

Copyright | Will Thompson and Iñaki García Etxebarria
License | LGPL-2.1
Maintainer | Iñaki García Etxebarria
Safe Haskell | None
Language | Haskell2010

GI.Graphene.Structs.Plane

Contents

- Exported types
- Methods
  - alloc
  - distance
  - equal
  - free
  - getConstant
  - getNormal
  - init
  - initFromPlane
  - initFromPoint
  - initFromPoints
  - initFromVec4
  - negate
  - normalize
  - transform

Description

A 2D plane that extends infinitely in a 3D volume.

The contents of the `graphene_plane_t` are private, and should not be modified directly.

Since: 1.2

Synopsis

- newtype Plane = Plane (ManagedPtr Plane)
- newZeroPlane :: MonadIO m => m Plane
- planeAlloc :: (HasCallStack, MonadIO m) => m Plane
- planeDistance :: (HasCallStack, MonadIO m) => Plane -> Point3D -> m Float
- planeEqual :: (HasCallStack, MonadIO m) => Plane -> Plane -> m Bool
- planeFree :: (HasCallStack, MonadIO m) => Plane -> m ()
- planeGetConstant :: (HasCallStack, MonadIO m) => Plane -> m Float
- planeGetNormal :: (HasCallStack, MonadIO m) => Plane -> m Vec3
- planeInit :: (HasCallStack, MonadIO m) => Plane -> Maybe Vec3 -> Float -> m Plane
- planeInitFromPlane :: (HasCallStack, MonadIO m) => Plane -> Plane -> m Plane
- planeInitFromPoint :: (HasCallStack, MonadIO m) => Plane -> Vec3 -> Point3D -> m Plane
- planeInitFromPoints :: (HasCallStack, MonadIO m) => Plane -> Point3D -> Point3D -> Point3D -> m Plane
- planeInitFromVec4 :: (HasCallStack, MonadIO m) => Plane -> Vec4 -> m Plane
- planeNegate :: (HasCallStack, MonadIO m) => Plane -> m Plane
- planeNormalize :: (HasCallStack, MonadIO m) => Plane -> m Plane
- planeTransform :: (HasCallStack, MonadIO m) => Plane -> Matrix -> Maybe Matrix -> m Plane

# Exported types

newtype Plane Source #

Memory-managed wrapper type.

Constructors

Plane (ManagedPtr Plane) |

#### Instances

Instances details

Eq Plane Source # |
Instance details Defined in GI.Graphene.Structs.Plane Methods (==) :: Plane -> Plane -> Bool Source # (/=) :: Plane -> Plane -> Bool Source #
GBoxed Plane Source # |
Instance details Defined in GI.Graphene.Structs.Plane
ManagedPtrNewtype Plane Source # |
Instance details Defined in GI.Graphene.Structs.Plane Methods toManagedPtr :: Plane -> ManagedPtr Plane Source #
TypedObject Plane Source # |
Instance details Defined in GI.Graphene.Structs.Plane Methods glibType :: IO GType Source #
HasParentTypes Plane Source # |
Instance details Defined in GI.Graphene.Structs.Plane
tag ~ 'AttrSet => Constructible Plane tag Source # |
Instance details Defined in GI.Graphene.Structs.Plane Methods new :: MonadIO m => (ManagedPtr Plane -> Plane) -> [AttrOp Plane tag] -> m Plane Source #
IsGValue (Maybe Plane) Source # | Convert `Plane` to and from `GValue`. See `toGValue` and `fromGValue`.
Instance details Defined in GI.Graphene.Structs.Plane Methods gvalueGType_ :: IO GType Source # gvalueSet_ :: Ptr GValue -> Maybe Plane -> IO () Source # gvalueGet_ :: Ptr GValue -> IO (Maybe Plane) Source #
type ParentTypes Plane Source # |
Instance details Defined in GI.Graphene.Structs.Plane type ParentTypes Plane = '[] :: [Type]

newZeroPlane :: MonadIO m => m Plane Source #

Construct a `Plane` struct initialized to zero.

# Methods

### Click to display all available methods, including inherited ones

Expand

#### Methods

distance, equal, free, init, initFromPlane, initFromPoint, initFromPoints, initFromVec4, negate, normalize, transform.

#### Getters

getConstant, getNormal.

#### Setters

None.

## alloc

planeAlloc Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> m Plane | Returns: the newly allocated `Plane`. Use `planeFree` to free the resources allocated by this function

Allocates a new `Plane` structure.

The contents of the returned structure are undefined.

Since: 1.2

## distance

planeDistance Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Plane | `p`: a `Plane`
-> Point3D | `point`: a `Point3D`
-> m Float | Returns: the distance of the given `Point3D` from the plane

Computes the distance of `point` from a `Plane`.

Since: 1.2

## equal

planeEqual Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Plane | `a`: a `Plane`
-> Plane | `b`: a `Plane`
-> m Bool | Returns: `true` if the given planes are equal

Checks whether the two given `Plane` are equal.

Since: 1.2

## free

planeFree Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Plane | `p`: a `Plane`
-> m () |

Frees the resources allocated by `planeAlloc`.

Since: 1.2

## getConstant

planeGetConstant Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Plane | `p`: a `Plane`
-> m Float | Returns: the constant value of the plane

Retrieves the distance along the normal vector of the given `Plane` from the origin.

Since: 1.2

## getNormal

planeGetNormal Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Plane | `p`: a `Plane`
-> m Vec3 |

Retrieves the normal vector pointing towards the origin of the given `Plane`.

Since: 1.2

## init

planeInit Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Plane | `p`: the `Plane` to initialize
-> Maybe Vec3 | `normal`: a unit length normal vector defining the plane pointing towards the origin; if unset, we use the X axis by default
-> Float | `constant`: the distance from the origin to the plane along the normal vector; the sign determines the half-space occupied by the plane
-> m Plane | Returns: the initialized plane

Initializes the given `Plane` using the given `normal` vector and `constant` values.

Since: 1.2

## initFromPlane

planeInitFromPlane Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Plane | `p`: the `Plane` to initialize
-> Plane | `src`: a `Plane`
-> m Plane | Returns: the initialized plane

Initializes the given `Plane` using the normal vector and constant of another `Plane`.

Since: 1.2

## initFromPoint

planeInitFromPoint Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Plane | `p`: the `Plane` to initialize
-> Vec3 | `normal`: a normal vector defining the plane pointing towards the origin
-> Point3D | `point`: a `Point3D`
-> m Plane | Returns: the initialized plane

Initializes the given `Plane` using the given normal vector and an arbitrary co-planar point.

Since: 1.2

## initFromPoints

planeInitFromPoints Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Plane | `p`: the `Plane` to initialize
-> Point3D | `a`: a `Point3D`
-> Point3D | `b`: a `Point3D`
-> Point3D | `c`: a `Point3D`
-> m Plane | Returns: the initialized plane

Initializes the given `Plane` using the 3 provided co-planar points.

The winding order is counter-clockwise, and determines which direction the normal vector will point.

Since: 1.2

## initFromVec4

planeInitFromVec4 Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Plane | `p`: the `Plane` to initialize
-> Vec4 | `src`: a `Vec4` containing the normal vector in its first three components, and the distance in its fourth component
-> m Plane | Returns: the initialized plane

Initializes the given `Plane` using the components of the given `Vec4` vector.

Since: 1.2

## negate

planeNegate Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Plane | `p`: a `Plane`
-> m Plane |

Negates the normal vector and constant of a `Plane`, effectively mirroring the plane across the origin.

Since: 1.2

## normalize

planeNormalize Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Plane | `p`: a `Plane`
-> m Plane |

Normalizes the vector of the given `Plane`, and adjusts the constant accordingly.

Since: 1.2

## transform

planeTransform Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Plane | `p`: a `Plane`
-> Matrix | `matrix`: a `Matrix`
-> Maybe Matrix | `normalMatrix`: a `Matrix`
-> m Plane |

Transforms a `Plane` `p` using the given `matrix` and `normalMatrix`.

If `normalMatrix` is `Nothing`, a transformation matrix for the plane normal will be computed from `matrix`. If you are transforming multiple planes using the same `matrix` it's recommended to compute the normal matrix beforehand to avoid incurring in the cost of recomputing it every time.

Since: 1.10