Gjsify LogoGjsify Logo

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.

record

Hierarchy

  • Vec2

Index

Constructors

Properties

name: string

Methods

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

    Parameters

    • b: Vec2

      a #graphene_vec2_t

    Returns Vec2

  • dot(b: Vec2): number
  • equal(v2: Vec2): boolean
  • free(): void
  • get_x(): number
  • get_y(): number
  • init(x: number, y: number): Vec2
  • Initializes a #graphene_vec2_t using the given values.

    This function can be called multiple times.

    Parameters

    • x: number

      the X field of the vector

    • y: number

      the Y field of the vector

    Returns Vec2

  • init_from_float(src: number[]): Vec2
  • Initializes v with the contents of the given array.

    Parameters

    • src: number[]

      an array of floating point values with at least two elements

    Returns Vec2

  • interpolate(v2: Vec2, factor: number): Vec2
  • length(): number
  • near(v2: Vec2, epsilon: number): boolean
  • Compares the two given #graphene_vec2_t vectors and checks whether their values are within the given epsilon.

    Parameters

    • v2: Vec2

      a #graphene_vec2_t

    • epsilon: number

      the threshold between the two vectors

    Returns boolean

  • scale(factor: number): 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.

    Parameters

    • b: Vec2

      a #graphene_vec2_t

    Returns Vec2

  • to_float(): number[]
  • Allocates a new #graphene_vec2_t structure.

    The contents of the returned structure are undefined.

    Use graphene_vec2_init() to initialize the vector.

    Returns Vec2

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Type alias with type parameter
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method