package ocgtk

  1. Overview
  2. Docs
OCaml bindings for GTK 4

Install

dune-project
 Dependency

Authors

Maintainers

Sources

v0.1-preview2.tar.gz
sha256=4e50fdb5093136a10fc8ffbe388e44cbcb70d52f8afdd48863ec7e22580ff054

doc/ocgtk.graphene/Ocgtk_graphene/Graphene/Wrappers/Vec2/index.html

Module Wrappers.Vec2

type t = [ `vec2 ] Gobject.obj

A structure capable of holding a vector with two dimensions, x and y.

The contents of the #graphene_vec2_t structure are private and should never be accessed directly.

val alloc : unit -> t

Create a new Vec2

val to_float : t -> float array

Stores the components of @v into an array.

val subtract : t -> t -> t

Subtracts from each component of the first operand @a the corresponding component of the second operand @b and places each result into the components of @res.

val scale : t -> float -> t

Multiplies all components of the given vector with the given scalar @factor.

val normalize : t -> t

Computes the normalized vector for the given vector @v.

val negate : t -> t

Negates the given #graphene_vec2_t.

val near : t -> t -> float -> bool

Compares the two given #graphene_vec2_t vectors and checks whether their values are within the given @epsilon.

val multiply : t -> t -> t

Multiplies each component of the two passed vectors and places each result into the components of @res.

val min : t -> t -> t

Compares the two given vectors and places the minimum values of each component into @res.

val max : t -> t -> t

Compares the two given vectors and places the maximum values of each component into @res.

val length : t -> float

Computes the length of the given vector.

val interpolate : t -> t -> float -> t

Linearly interpolates @v1 and @v2 using the given @factor.

val init_from_vec2 : t -> t -> t

Copies the contents of @src into @v.

val init_from_float : t -> float array -> t

Initializes @v with the contents of the given array.

val init : t -> float -> float -> t

Initializes a #graphene_vec2_t using the given values.

This function can be called multiple times.

val get_y : t -> float

Retrieves the Y component of the #graphene_vec2_t.

val get_x : t -> float

Retrieves the X component of the #graphene_vec2_t.

val equal : t -> t -> bool

Checks whether the two given #graphene_vec2_t are equal.

val dot : t -> t -> float

Computes the dot product of the two given vectors.

val divide : t -> t -> t

Divides each component of the first operand @a by the corresponding component of the second operand @b, and places the results into the vector @res.

val add : t -> t -> t

Adds each component of the two passed vectors and places each result into the components of @res.

val get_type : unit -> Gobject.Type.t