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

Contents

- Exported types
- Methods
  - alloc
  - containsPoint
  - distance
  - equal
  - free
  - getBoundingBox
  - getCenter
  - getRadius
  - init
  - initFromPoints
  - initFromVectors
  - isEmpty
  - translate

Description

A sphere, represented by its center and radius.

Since: 1.2

Synopsis

- newtype Sphere = Sphere (ManagedPtr Sphere)
- newZeroSphere :: MonadIO m => m Sphere
- sphereAlloc :: (HasCallStack, MonadIO m) => m Sphere
- sphereContainsPoint :: (HasCallStack, MonadIO m) => Sphere -> Point3D -> m Bool
- sphereDistance :: (HasCallStack, MonadIO m) => Sphere -> Point3D -> m Float
- sphereEqual :: (HasCallStack, MonadIO m) => Sphere -> Sphere -> m Bool
- sphereFree :: (HasCallStack, MonadIO m) => Sphere -> m ()
- sphereGetBoundingBox :: (HasCallStack, MonadIO m) => Sphere -> m Box
- sphereGetCenter :: (HasCallStack, MonadIO m) => Sphere -> m Point3D
- sphereGetRadius :: (HasCallStack, MonadIO m) => Sphere -> m Float
- sphereInit :: (HasCallStack, MonadIO m) => Sphere -> Maybe Point3D -> Float -> m Sphere
- sphereInitFromPoints :: (HasCallStack, MonadIO m) => Sphere -> [Point3D] -> Maybe Point3D -> m Sphere
- sphereInitFromVectors :: (HasCallStack, MonadIO m) => Sphere -> [Vec3] -> Maybe Point3D -> m Sphere
- sphereIsEmpty :: (HasCallStack, MonadIO m) => Sphere -> m Bool
- sphereTranslate :: (HasCallStack, MonadIO m) => Sphere -> Point3D -> m Sphere

# Exported types

newtype Sphere Source #

Memory-managed wrapper type.

Constructors

Sphere (ManagedPtr Sphere) |

#### Instances

Instances details

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

newZeroSphere :: MonadIO m => m Sphere Source #

Construct a `Sphere` struct initialized to zero.

# Methods

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

Expand

#### Methods

containsPoint, distance, equal, free, init, initFromPoints, initFromVectors, isEmpty, translate.

#### Getters

getBoundingBox, getCenter, getRadius.

#### Setters

None.

## alloc

sphereAlloc Source #

Arguments

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

Allocates a new `Sphere`.

The contents of the newly allocated structure are undefined.

Since: 1.2

## containsPoint

sphereContainsPoint Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Sphere | `s`: a `Sphere`
-> Point3D | `point`: a `Point3D`
-> m Bool | Returns: `true` if the sphere contains the point

Checks whether the given `point` is contained in the volume of a `Sphere`.

Since: 1.2

## distance

sphereDistance Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Sphere | `s`: a `Sphere`
-> Point3D | `point`: a `Point3D`
-> m Float | Returns: the distance of the point

Computes the distance of the given `point` from the surface of a `Sphere`.

Since: 1.2

## equal

sphereEqual Source #

Arguments

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

Checks whether two `Sphere` are equal.

Since: 1.2

## free

sphereFree Source #

Arguments

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

Frees the resources allocated by `sphereAlloc`.

Since: 1.2

## getBoundingBox

sphereGetBoundingBox Source #

Arguments

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

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

Since: 1.2

## getCenter

sphereGetCenter Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Sphere | `s`: a `Sphere`
-> m Point3D |

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

Since: 1.2

## getRadius

sphereGetRadius Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Sphere | `s`: a `Sphere`
-> m Float |

Retrieves the radius of a `Sphere`.

Since: 1.2

## init

sphereInit Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Sphere | `s`: the `Sphere` to initialize
-> Maybe Point3D | `center`: the coordinates of the center of the sphere, or `Nothing` for a center in (0, 0, 0)
-> Float | `radius`: the radius of the sphere
-> m Sphere | Returns: the initialized `Sphere`

Initializes the given `Sphere` with the given `center` and `radius`.

Since: 1.2

## initFromPoints

sphereInitFromPoints Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Sphere | `s`: the `Sphere` to initialize
-> [Point3D] | `points`: an array of `Point3D`
-> Maybe Point3D | `center`: the center of the sphere
-> m Sphere | Returns: the initialized `Sphere`

Initializes the given `Sphere` using the given array of 3D coordinates so that the sphere includes them.

The center of the sphere can either be specified, or will be center of the 3D volume that encompasses all `points`.

Since: 1.2

## initFromVectors

sphereInitFromVectors Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Sphere | `s`: the `Sphere` to initialize
-> [Vec3] | `vectors`: an array of `Vec3`
-> Maybe Point3D | `center`: the center of the sphere
-> m Sphere | Returns: the initialized `Sphere`

Initializes the given `Sphere` using the given array of 3D coordinates so that the sphere includes them.

The center of the sphere can either be specified, or will be center of the 3D volume that encompasses all `vectors`.

Since: 1.2

## isEmpty

sphereIsEmpty Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Sphere | `s`: a `Sphere`
-> m Bool | Returns: `true` if the sphere is empty

Checks whether the sphere has a zero radius.

Since: 1.2

## translate

sphereTranslate Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Sphere | `s`: a `Sphere`
-> Point3D | `point`: the coordinates of the translation
-> m Sphere |

Translates the center of the given `Sphere` using the `point` coordinates as the delta of the translation.

Since: 1.2