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.Box

Contents

- Exported types
- Methods
  - alloc
  - containsBox
  - containsPoint
  - empty
  - equal
  - expand
  - expandScalar
  - expandVec3
  - free
  - getBoundingSphere
  - getCenter
  - getDepth
  - getHeight
  - getMax
  - getMin
  - getSize
  - getWidth
  - infinite
  - init
  - initFromBox
  - initFromPoints
  - initFromVec3
  - initFromVectors
  - intersection
  - minusOne
  - one
  - oneMinusOne
  - union
  - zero

Description

A 3D box, described as the volume between a minimum and a maximum vertices.

Since: 1.2

Synopsis

- newtype Box = Box (ManagedPtr Box)
- newZeroBox :: MonadIO m => m Box
- boxAlloc :: (HasCallStack, MonadIO m) => m Box
- boxContainsBox :: (HasCallStack, MonadIO m) => Box -> Box -> m Bool
- boxContainsPoint :: (HasCallStack, MonadIO m) => Box -> Point3D -> m Bool
- boxEmpty :: (HasCallStack, MonadIO m) => m Box
- boxEqual :: (HasCallStack, MonadIO m) => Box -> Box -> m Bool
- boxExpand :: (HasCallStack, MonadIO m) => Box -> Point3D -> m Box
- boxExpandScalar :: (HasCallStack, MonadIO m) => Box -> Float -> m Box
- boxExpandVec3 :: (HasCallStack, MonadIO m) => Box -> Vec3 -> m Box
- boxFree :: (HasCallStack, MonadIO m) => Box -> m ()
- boxGetBoundingSphere :: (HasCallStack, MonadIO m) => Box -> m Sphere
- boxGetCenter :: (HasCallStack, MonadIO m) => Box -> m Point3D
- boxGetDepth :: (HasCallStack, MonadIO m) => Box -> m Float
- boxGetHeight :: (HasCallStack, MonadIO m) => Box -> m Float
- boxGetMax :: (HasCallStack, MonadIO m) => Box -> m Point3D
- boxGetMin :: (HasCallStack, MonadIO m) => Box -> m Point3D
- boxGetSize :: (HasCallStack, MonadIO m) => Box -> m Vec3
- boxGetWidth :: (HasCallStack, MonadIO m) => Box -> m Float
- boxInfinite :: (HasCallStack, MonadIO m) => m Box
- boxInit :: (HasCallStack, MonadIO m) => Box -> Maybe Point3D -> Maybe Point3D -> m Box
- boxInitFromBox :: (HasCallStack, MonadIO m) => Box -> Box -> m Box
- boxInitFromPoints :: (HasCallStack, MonadIO m) => Box -> [Point3D] -> m Box
- boxInitFromVec3 :: (HasCallStack, MonadIO m) => Box -> Maybe Vec3 -> Maybe Vec3 -> m Box
- boxInitFromVectors :: (HasCallStack, MonadIO m) => Box -> [Vec3] -> m Box
- boxIntersection :: (HasCallStack, MonadIO m) => Box -> Box -> m (Bool, Box)
- boxMinusOne :: (HasCallStack, MonadIO m) => m Box
- boxOne :: (HasCallStack, MonadIO m) => m Box
- boxOneMinusOne :: (HasCallStack, MonadIO m) => m Box
- boxUnion :: (HasCallStack, MonadIO m) => Box -> Box -> m Box
- boxZero :: (HasCallStack, MonadIO m) => m Box

# Exported types

newtype Box Source #

Memory-managed wrapper type.

Constructors

Box (ManagedPtr Box) |

#### Instances

Instances details

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

newZeroBox :: MonadIO m => m Box Source #

Construct a `Box` struct initialized to zero.

# Methods

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

Expand

#### Methods

containsBox, containsPoint, equal, expand, expandScalar, expandVec3, free, init, initFromBox, initFromPoints, initFromVec3, initFromVectors, intersection, union.

#### Getters

getBoundingSphere, getCenter, getDepth, getHeight, getMax, getMin, getSize, getWidth.

#### Setters

None.

## alloc

boxAlloc Source #

Arguments

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

Allocates a new `Box`.

The contents of the returned structure are undefined.

Since: 1.2

## containsBox

boxContainsBox Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Box | `a`: a `Box`
-> Box | `b`: a `Box`
-> m Bool | Returns: `true` if the box is contained in the given box

Checks whether the `Box` `a` contains the given `Box` `b`.

Since: 1.2

## containsPoint

boxContainsPoint Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Box | `box`: a `Box`
-> Point3D | `point`: the coordinates to check
-> m Bool | Returns: `true` if the point is contained in the given box

Checks whether `box` contains the given `point`.

Since: 1.2

## empty

boxEmpty Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> m Box | Returns: a `Box`

A degenerate `Box` that can only be expanded.

The returned value is owned by Graphene and should not be modified or freed.

Since: 1.2

## equal

boxEqual Source #

Arguments

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

Checks whether the two given boxes are equal.

Since: 1.2

## expand

boxExpand Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Box | `box`: a `Box`
-> Point3D | `point`: the coordinates of the point to include
-> m Box |

Expands the dimensions of `box` to include the coordinates at `point`.

Since: 1.2

## expandScalar

boxExpandScalar Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Box | `box`: a `Box`
-> Float | `scalar`: a scalar value
-> m Box |

Expands the dimensions of `box` by the given `scalar` value.

If `scalar` is positive, the `Box` will grow; if `scalar` is negative, the `Box` will shrink.

Since: 1.2

## expandVec3

boxExpandVec3 Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Box | `box`: a `Box`
-> Vec3 | `vec`: the coordinates of the point to include, as a `Vec3`
-> m Box |

Expands the dimensions of `box` to include the coordinates of the given vector.

Since: 1.2

## free

boxFree Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Box | `box`: a `Box`
-> m () |

Frees the resources allocated by `boxAlloc`.

Since: 1.2

## getBoundingSphere

boxGetBoundingSphere Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Box | `box`: a `Box`
-> m Sphere |

Computes the bounding `Sphere` capable of containing the given `Box`.

Since: 1.2

## getCenter

boxGetCenter Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Box | `box`: a `Box`
-> m Point3D |

Retrieves the coordinates of the center of a `Box`.

Since: 1.2

## getDepth

boxGetDepth Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Box | `box`: a `Box`
-> m Float | Returns: the depth of the box

Retrieves the size of the `box` on the Z axis.

Since: 1.2

## getHeight

boxGetHeight Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Box | `box`: a `Box`
-> m Float | Returns: the height of the box

Retrieves the size of the `box` on the Y axis.

Since: 1.2

## getMax

boxGetMax Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Box | `box`: a `Box`
-> m Point3D |

Retrieves the coordinates of the maximum point of the given `Box`.

Since: 1.2

## getMin

boxGetMin Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Box | `box`: a `Box`
-> m Point3D |

Retrieves the coordinates of the minimum point of the given `Box`.

Since: 1.2

## getSize

boxGetSize Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Box | `box`: a `Box`
-> m Vec3 |

Retrieves the size of the box on all three axes, and stores it into the given `size` vector.

Since: 1.2

## getWidth

boxGetWidth Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Box | `box`: a `Box`
-> m Float | Returns: the width of the box

Retrieves the size of the `box` on the X axis.

Since: 1.2

## infinite

boxInfinite Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> m Box | Returns: a `Box`

A degenerate `Box` that cannot be expanded.

The returned value is owned by Graphene and should not be modified or freed.

Since: 1.2

## init

boxInit Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Box | `box`: the `Box` to initialize
-> Maybe Point3D | `min`: the coordinates of the minimum vertex
-> Maybe Point3D | `max`: the coordinates of the maximum vertex
-> m Box | Returns: the initialized `Box`

Initializes the given `Box` with two vertices.

Since: 1.2

## initFromBox

boxInitFromBox Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Box | `box`: the `Box` to initialize
-> Box | `src`: a `Box`
-> m Box | Returns: the initialized `Box`

Initializes the given `Box` with the vertices of another `Box`.

Since: 1.2

## initFromPoints

boxInitFromPoints Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Box | `box`: the `Box` to initialize
-> [Point3D] | `points`: an array of `Point3D`
-> m Box | Returns: the initialized `Box`

Initializes the given `Box` with the given array of vertices.

If `nPoints` is 0, the returned box is initialized with `boxEmpty`.

Since: 1.2

## initFromVec3

boxInitFromVec3 Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Box | `box`: the `Box` to initialize
-> Maybe Vec3 | `min`: the coordinates of the minimum vertex
-> Maybe Vec3 | `max`: the coordinates of the maximum vertex
-> m Box | Returns: the initialized `Box`

Initializes the given `Box` with two vertices stored inside `Vec3`.

Since: 1.2

## initFromVectors

boxInitFromVectors Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Box | `box`: the `Box` to initialize
-> [Vec3] | `vectors`: an array of `Vec3`
-> m Box | Returns: the initialized `Box`

Initializes the given `Box` with the given array of vertices.

If `nVectors` is 0, the returned box is initialized with `boxEmpty`.

Since: 1.2

## intersection

boxIntersection Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Box | `a`: a `Box`
-> Box | `b`: a `Box`
-> m (Bool, Box) | Returns: true if the two boxes intersect

Intersects the two given `Box`.

If the two boxes do not intersect, `res` will contain a degenerate box initialized with `boxEmpty`.

Since: 1.2

## minusOne

boxMinusOne Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> m Box | Returns: a `Box`

A `Box` with the minimum vertex set at (-1, -1, -1) and the maximum vertex set at (0, 0, 0).

The returned value is owned by Graphene and should not be modified or freed.

Since: 1.2

## one

boxOne Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> m Box | Returns: a `Box`

A `Box` with the minimum vertex set at (0, 0, 0) and the maximum vertex set at (1, 1, 1).

The returned value is owned by Graphene and should not be modified or freed.

Since: 1.2

## oneMinusOne

boxOneMinusOne Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> m Box | Returns: a `Box`

A `Box` with the minimum vertex set at (-1, -1, -1) and the maximum vertex set at (1, 1, 1).

The returned value is owned by Graphene and should not be modified or freed.

Since: 1.2

## union

boxUnion Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Box | `a`: a `Box`
-> Box | `b`: the box to union to `a`
-> m Box |

Unions the two given `Box`.

Since: 1.2

## zero

boxZero Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> m Box | Returns: a `Box`

A `Box` with both the minimum and maximum vertices set at (0, 0, 0).

The returned value is owned by Graphene and should not be modified or freed.

Since: 1.2