2.25. Vector2f

2.25.1. Synopsis

2.25.1.1. Functions

2.25.1.2. Static functions

2.25.1.3. Properties

  • property x [read-write] of float

  • property y [read-write] of float

2.25.2. Detailed Description

A class representing a two-vector of floats. It is implicitly convertible to a tuple containing two floats and can be constructed like Vector2f((0.1, 0.2)).

class mocha.project.Vector2f
class mocha.project.Vector2f(Vector2f)
Vector2f.__repr__()
Return type

object

Vector2f.__str__()
Return type

object

Vector2f.get_x()
Return type

float

Vector2f.get_y()
Return type

float

Vector2f.length()
Return type

float

Returns the length of the vector.

Vector2f.normalise()

Normalises the vector so that its length is 1.

Does nothing if the this is a zero vector.

Vector2f.__ne__(arg__1)
Return type

bool

Vector2f.__mul__(arg__1)
Return type

float

Returns the dot product of this vector with another.

static Vector2f.__mul__(arg__1)
Return type

Vector2f

Vector2f.__mul__(arg__1)
Return type

Vector2f

Returns the vector which is the result of the mulitplication of this vector by a scalar.

Vector2f.__add__(arg__1)
Return type

Vector2f

Returns the result of adding a vector to this vector.

Vector2f.__sub__(arg__1)
Return type

Vector2f

Returns the result of adding subtracting a vector from this vector.

Vector2f.__div__(arg__1)
Return type

Vector2f

Returns the vector which is the result of the division of this vector by a scalar.

Raises RuntimeError if the argument is zero.

Vector2f.__eq__(arg__1)
Return type

bool

Vector2f.set_x(arg__1)
Vector2f.set_y(arg__1)
Oberon::Vector2f.x
Type

float

Access

read-write The x coordinate of this vector.

Oberon::Vector2f.y
Type

float

Access

read-write The y coordinate of this vector.