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

Contents

- Exported types
- Methods
  - alloc
  - equal
  - free
  - getClosestPointToPoint
  - getDirection
  - getDistanceToPlane
  - getDistanceToPoint
  - getOrigin
  - getPositionAt
  - init
  - initFromRay
  - initFromVec3
  - intersectBox
  - intersectSphere
  - intersectTriangle
  - intersectsBox
  - intersectsSphere
  - intersectsTriangle

Description

A ray emitted from an origin in a given direction.

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

Since: 1.4

Synopsis

- newtype Ray = Ray (ManagedPtr Ray)
- newZeroRay :: MonadIO m => m Ray
- rayAlloc :: (HasCallStack, MonadIO m) => m Ray
- rayEqual :: (HasCallStack, MonadIO m) => Ray -> Ray -> m Bool
- rayFree :: (HasCallStack, MonadIO m) => Ray -> m ()
- rayGetClosestPointToPoint :: (HasCallStack, MonadIO m) => Ray -> Point3D -> m Point3D
- rayGetDirection :: (HasCallStack, MonadIO m) => Ray -> m Vec3
- rayGetDistanceToPlane :: (HasCallStack, MonadIO m) => Ray -> Plane -> m Float
- rayGetDistanceToPoint :: (HasCallStack, MonadIO m) => Ray -> Point3D -> m Float
- rayGetOrigin :: (HasCallStack, MonadIO m) => Ray -> m Point3D
- rayGetPositionAt :: (HasCallStack, MonadIO m) => Ray -> Float -> m Point3D
- rayInit :: (HasCallStack, MonadIO m) => Ray -> Maybe Point3D -> Maybe Vec3 -> m Ray
- rayInitFromRay :: (HasCallStack, MonadIO m) => Ray -> Ray -> m Ray
- rayInitFromVec3 :: (HasCallStack, MonadIO m) => Ray -> Maybe Vec3 -> Maybe Vec3 -> m Ray
- rayIntersectBox :: (HasCallStack, MonadIO m) => Ray -> Box -> m (RayIntersectionKind, Float)
- rayIntersectSphere :: (HasCallStack, MonadIO m) => Ray -> Sphere -> m (RayIntersectionKind, Float)
- rayIntersectTriangle :: (HasCallStack, MonadIO m) => Ray -> Triangle -> m (RayIntersectionKind, Float)
- rayIntersectsBox :: (HasCallStack, MonadIO m) => Ray -> Box -> m Bool
- rayIntersectsSphere :: (HasCallStack, MonadIO m) => Ray -> Sphere -> m Bool
- rayIntersectsTriangle :: (HasCallStack, MonadIO m) => Ray -> Triangle -> m Bool

# Exported types

newtype Ray Source #

Memory-managed wrapper type.

Constructors

Ray (ManagedPtr Ray) |

#### Instances

Instances details

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

newZeroRay :: MonadIO m => m Ray Source #

Construct a `Ray` struct initialized to zero.

# Methods

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

Expand

#### Methods

equal, free, init, initFromRay, initFromVec3, intersectBox, intersectSphere, intersectTriangle, intersectsBox, intersectsSphere, intersectsTriangle.

#### Getters

getClosestPointToPoint, getDirection, getDistanceToPlane, getDistanceToPoint, getOrigin, getPositionAt.

#### Setters

None.

## alloc

rayAlloc Source #

Arguments

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

Allocates a new `Ray` structure.

The contents of the returned structure are undefined.

Since: 1.4

## equal

rayEqual Source #

Arguments

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

Checks whether the two given `Ray` are equal.

Since: 1.4

## free

rayFree Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Ray | `r`: a `Ray`
-> m () |

Frees the resources allocated by `rayAlloc`.

Since: 1.4

## getClosestPointToPoint

rayGetClosestPointToPoint Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Ray | `r`: a `Ray`
-> Point3D | `p`: a `Point3D`
-> m Point3D |

Computes the point on the given `Ray` that is closest to the given point `p`.

Since: 1.4

## getDirection

rayGetDirection Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Ray | `r`: a `Ray`
-> m Vec3 |

Retrieves the direction of the given `Ray`.

Since: 1.4

## getDistanceToPlane

rayGetDistanceToPlane Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Ray | `r`: a `Ray`
-> Plane | `p`: a `Plane`
-> m Float | Returns: the distance of the origin of the ray from the plane

Computes the distance of the origin of the given `Ray` from the given plane.

If the ray does not intersect the plane, this function returns `INFINITY`.

Since: 1.4

## getDistanceToPoint

rayGetDistanceToPoint Source #

Arguments

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

Computes the distance of the closest approach between the given `Ray` `r` and the point `p`.

The closest approach to a ray from a point is the distance between the point and the projection of the point on the ray itself.

Since: 1.4

## getOrigin

rayGetOrigin Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Ray | `r`: a `Ray`
-> m Point3D |

Retrieves the origin of the given `Ray`.

Since: 1.4

## getPositionAt

rayGetPositionAt Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Ray | `r`: a `Ray`
-> Float | `t`: the distance along the ray
-> m Point3D |

Retrieves the coordinates of a point at the distance `t` along the given `Ray`.

Since: 1.4

## init

rayInit Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Ray | `r`: the `Ray` to initialize
-> Maybe Point3D | `origin`: the origin of the ray
-> Maybe Vec3 | `direction`: the direction vector
-> m Ray | Returns: the initialized ray

Initializes the given `Ray` using the given `origin` and `direction` values.

Since: 1.4

## initFromRay

rayInitFromRay Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Ray | `r`: the `Ray` to initialize
-> Ray | `src`: a `Ray`
-> m Ray | Returns: the initialized ray

Initializes the given `Ray` using the origin and direction values of another `Ray`.

Since: 1.4

## initFromVec3

rayInitFromVec3 Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Ray | `r`: the `Ray` to initialize
-> Maybe Vec3 | `origin`: a `Vec3`
-> Maybe Vec3 | `direction`: a `Vec3`
-> m Ray | Returns: the initialized ray

Initializes the given `Ray` using the given vectors.

Since: 1.4

## intersectBox

rayIntersectBox Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Ray | `r`: a `Ray`
-> Box | `b`: a `Box`
-> m (RayIntersectionKind, Float) | Returns: the type of intersection

Intersects the given `Ray` `r` with the given `Box` `b`.

Since: 1.10

## intersectSphere

rayIntersectSphere Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Ray | `r`: a `Ray`
-> Sphere | `s`: a `Sphere`
-> m (RayIntersectionKind, Float) | Returns: the type of intersection

Intersects the given `Ray` `r` with the given `Sphere` `s`.

Since: 1.10

## intersectTriangle

rayIntersectTriangle Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Ray | `r`: a `Ray`
-> Triangle | `t`: a `Triangle`
-> m (RayIntersectionKind, Float) | Returns: the type of intersection

Intersects the given `Ray` `r` with the given `Triangle` `t`.

Since: 1.10

## intersectsBox

rayIntersectsBox Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Ray | `r`: a `Ray`
-> Box | `b`: a `Box`
-> m Bool | Returns: `true` if the ray intersects the box

Checks whether the given `Ray` `r` intersects the given `Box` `b`.

See also: `rayIntersectBox`

Since: 1.10

## intersectsSphere

rayIntersectsSphere Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Ray | `r`: a `Ray`
-> Sphere | `s`: a `Sphere`
-> m Bool | Returns: `true` if the ray intersects the sphere

Checks if the given `Ray` `r` intersects the given `Sphere` `s`.

See also: `rayIntersectSphere`

Since: 1.10

## intersectsTriangle

rayIntersectsTriangle Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Ray | `r`: a `Ray`
-> Triangle | `t`: a `Triangle`
-> m Bool | Returns: `true` if the ray intersects the triangle

Checks whether the given `Ray` `r` intersects the given `Triangle` `b`.

See also: `rayIntersectTriangle`

Since: 1.10