Skip to content

Vector2f

IsaacShelton edited this page Apr 8, 2022 · 7 revisions

Vector2f

Vector2f represents the type of a two float vector.

Specifications

Type Size Memory Management Model File
Vector2f 8 bytes None 2.6/Vector2f.adept

Definition

struct Vector2f (x, y float)

Fields

Name Type Description
x float X Value
y float Y Value

Overloads

  • func __add__(a POD Vector2f, b POD Vector2f) Vector2f
  • func __subtract__(a POD Vector2f, b POD Vector2f) Vector2f
  • func __multiply__(a POD Vector2f, b POD Vector2f) Vector2f
  • func __multiply__(a POD Vector2f, factor float) Vector2f

Functions

  • func vector2f(x, y float) Vector2f

    Constructs a Vector2f.

    [view src]

Methods

  • func zero(this *Vector2f) void

    Sets all components of a vector to zero.

    [view src]

  • func set(this *Vector2f, x, y float) void

    Sets the components of a vector.

    [view src]

  • func set(this *Vector2f, other Vector2f) void

    Sets the components of a vector to those of another.

    [view src]

  • func add(this *Vector2f, other Vector2f) void

    Adds the components of a vector to another.

    [view src]

  • func subtract(this *Vector2f, other Vector2f) void

    Subtracts the components of a vector from another.

    [view src]

  • func multiply(this *Vector2f, other Vector2f) void

    Multiplies the components of a vector by another.

    [view src]

  • func negate(this *Vector2f) void

    Negates the components of a vector.

    [view src]

  • func negated(this *Vector2f) Vector2f

    Returns a negated copy of a vector.

    [view src]

  • func scale(this *Vector2f, amount float) void

    Scales a vector by a scalar.

    [view src]

  • func normalize(this *Vector2f) void

    Normalizes a vector.

    [view src]

  • func cross(this *Vector2f, other Vector2f) float

    Calculates the cross-product of two vectors.

    [view src]

  • func length(this *Vector2f) float

    Calculates the length of a vector.

    [view src]

  • func dot(this *Vector2f, other Vector2f) float

    Calculates the dot product of two vectors.

    [view src]

  • func lerp(this *Vector2f, other Vector2f, lerp float) void

    Linearly interpolates between two vectors by lerp [0.0, 1.0] amount.

    [view src]

  • func lerp(this *Vector2f, other Vector2f) void

    Linearly interpolates halfway between two vectors.

    [view src]

  • func distance(this *Vector2f, other Vector2f) float

    Calculates the distance between two points.

    [view src]

  • func toString(this *Vector2f) String

    Converts a vector to a String.

    [view src]

  • func print(this *Vector2f) void

    Prints a vector to stdout.

    [view src]

Clone this wiki locally