| Copyright | Will Thompson and Iñaki García Etxebarria |
|---|---|
| License | LGPL-2.1 |
| Maintainer | Iñaki García Etxebarria |
| Safe Haskell | Safe-Inferred |
| Language | Haskell2010 |
GI.Graphene.Structs.Point
Description
A point with two coordinates.
Since: 1.0
Synopsis
- newtype Point = Point (ManagedPtr Point)
- newZeroPoint :: MonadIO m => m Point
- pointAlloc :: (HasCallStack, MonadIO m) => m Point
- pointDistance :: (HasCallStack, MonadIO m) => Point -> Point -> m (Float, Float, Float)
- pointEqual :: (HasCallStack, MonadIO m) => Point -> Point -> m Bool
- pointFree :: (HasCallStack, MonadIO m) => Point -> m ()
- pointInit :: (HasCallStack, MonadIO m) => Point -> Float -> Float -> m Point
- pointInitFromPoint :: (HasCallStack, MonadIO m) => Point -> Point -> m Point
- pointInitFromVec2 :: (HasCallStack, MonadIO m) => Point -> Vec2 -> m Point
- pointInterpolate :: (HasCallStack, MonadIO m) => Point -> Point -> Double -> m Point
- pointNear :: (HasCallStack, MonadIO m) => Point -> Point -> Float -> m Bool
- pointToVec2 :: (HasCallStack, MonadIO m) => Point -> m Vec2
- pointZero :: (HasCallStack, MonadIO m) => m Point
- getPointX :: MonadIO m => Point -> m Float
- setPointX :: MonadIO m => Point -> Float -> m ()
- getPointY :: MonadIO m => Point -> m Float
- setPointY :: MonadIO m => Point -> Float -> m ()
Exported types
Memory-managed wrapper type.
Instances
| Eq Point Source # | |
| GBoxed Point Source # | |
Defined in GI.Graphene.Structs.Point | |
| ManagedPtrNewtype Point Source # | |
Defined in GI.Graphene.Structs.Point Methods toManagedPtr :: Point -> ManagedPtr Point | |
| TypedObject Point Source # | |
Defined in GI.Graphene.Structs.Point | |
| HasParentTypes Point Source # | |
Defined in GI.Graphene.Structs.Point | |
| tag ~ 'AttrSet => Constructible Point tag Source # | |
| IsGValue (Maybe Point) Source # | Convert |
Defined in GI.Graphene.Structs.Point Methods gvalueGType_ :: IO GType gvalueSet_ :: Ptr GValue -> Maybe Point -> IO () gvalueGet_ :: Ptr GValue -> IO (Maybe Point) | |
| type ParentTypes Point Source # | |
Defined in GI.Graphene.Structs.Point | |
Methods
Click to display all available methods, including inherited ones
Methods
distance, equal, free, init, initFromPoint, initFromVec2, interpolate, near, toVec2.
Getters
None.
Setters
None.
alloc
Arguments
| :: (HasCallStack, MonadIO m) | |
| => m Point | Returns: the newly allocated |
Allocates a new Point structure.
The coordinates of the returned point are (0, 0).
It's possible to chain this function with pointInit
or pointInitFromPoint, e.g.:
C code
graphene_point_t *
point_new (float x, float y)
{
return graphene_point_init (graphene_point_alloc (), x, y);
}
graphene_point_t *
point_copy (const graphene_point_t *p)
{
return graphene_point_init_from_point (graphene_point_alloc (), p);
}Since: 1.0
distance
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Point |
|
| -> Point |
|
| -> m (Float, Float, Float) | Returns: the distance between the two points |
Computes the distance between a and b.
Since: 1.0
equal
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Point |
|
| -> Point |
|
| -> m Bool | Returns: |
Checks if the two points a and b point to the same
coordinates.
This function accounts for floating point fluctuations; if
you want to control the fuzziness of the match, you can use
pointNear instead.
Since: 1.0
free
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Point |
|
| -> m () |
Frees the resources allocated by pointAlloc.
Since: 1.0
init
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Point |
|
| -> Float |
|
| -> Float |
|
| -> m Point | Returns: the initialized point |
Initializes p to the given x and y coordinates.
It's safe to call this function multiple times.
Since: 1.0
initFromPoint
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Point |
|
| -> Point |
|
| -> m Point | Returns: the initialized point |
Initializes p with the same coordinates of src.
Since: 1.0
initFromVec2
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Point |
|
| -> Vec2 |
|
| -> m Point | Returns: the initialized point |
Initializes p with the coordinates inside the given Vec2.
Since: 1.4
interpolate
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Point |
|
| -> Point |
|
| -> Double |
|
| -> m Point |
Linearly interpolates the coordinates of a and b using the
given factor.
Since: 1.0
near
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Point |
|
| -> Point |
|
| -> Float |
|
| -> m Bool | Returns: |
Checks whether the two points a and b are within
the threshold of epsilon.
Since: 1.0
toVec2
Arguments
| :: (HasCallStack, MonadIO m) | |
| => Point |
|
| -> m Vec2 |
zero
Arguments
| :: (HasCallStack, MonadIO m) | |
| => m Point | Returns: a fixed point |
Returns a point fixed at (0, 0).
Since: 1.0
Properties
x
the X coordinate of the point
getPointX :: MonadIO m => Point -> m Float Source #
Get the value of the “x” field.
When overloading is enabled, this is equivalent to
get point #x
setPointX :: MonadIO m => Point -> Float -> m () Source #
Set the value of the “x” field.
When overloading is enabled, this is equivalent to
setpoint [ #x:=value ]
y
the Y coordinate of the point