Vec2

class Vec2(pointer: <Error class: unknown class><<Error class: unknown class>>)

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.

Skipped during bindings generation

  • parameter src: Array parameter of type gfloat is not supported

  • parameter dest: dest: Out parameter is not supported

  • field value: Record field value is private

Constructors

Link copied to clipboard
constructor(pointer: <Error class: unknown class><<Error class: unknown class>>)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
val grapheneVec2Pointer: <Error class: unknown class><<Error class: unknown class>>

Functions

Link copied to clipboard
fun add(b: Vec2, res: Vec2)

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

Link copied to clipboard
fun divide(b: Vec2, res: Vec2)

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.

Link copied to clipboard
fun dot(b: Vec2): Float

Computes the dot product of the two given vectors.

Link copied to clipboard
fun equal(v2: Vec2): Boolean

Checks whether the two given #graphene_vec2_t are equal.

Link copied to clipboard
fun free()

Frees the resources allocated by @v

Link copied to clipboard
fun getX(): Float

Retrieves the X component of the #graphene_vec2_t.

Link copied to clipboard
fun getY(): Float

Retrieves the Y component of the #graphene_vec2_t.

Link copied to clipboard
fun init(x: Float, y: Float): Vec2

Initializes a #graphene_vec2_t using the given values.

Link copied to clipboard

Copies the contents of @src into @v.

Link copied to clipboard
fun interpolate(v2: Vec2, factor: Double, res: Vec2)

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

Link copied to clipboard
fun length(): Float

Computes the length of the given vector.

Link copied to clipboard
fun max(b: Vec2, res: Vec2)

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

Link copied to clipboard
fun min(b: Vec2, res: Vec2)

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

Link copied to clipboard
fun multiply(b: Vec2, res: Vec2)

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

Link copied to clipboard
fun near(v2: Vec2, epsilon: Float): Boolean

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

Link copied to clipboard
fun negate(res: Vec2)

Negates the given #graphene_vec2_t.

Link copied to clipboard
fun normalize(res: Vec2)

Computes the normalized vector for the given vector @v.

Link copied to clipboard
fun scale(factor: Float, res: Vec2)

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

Link copied to clipboard
fun subtract(b: Vec2, res: Vec2)

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.