semvec/pypi-packages huggingface dataset:
kvector2 1.4.1
implement 2D vectors
License: mit
Requires Python: >=3.6

#vector2.py

Module to handle vectors in a 2D space.

**vector2.Vector :**

Represent a 2D vector. It can be interpreted as a tuple of length 2 like (x, y).
  
You can declare a vector by passing :
  
`Vector()` -> null vector

`Vector( (x, y) )` -> vector of coordinates (`x`, `y`)

`Vector( angle, length )` -> vector of length `length` pointing towards `angle` in radians

`Vector( angle=a, len=l )` -> same as `Vector(a, l)`

`Vector( coords=t )` -> same as `Vector(t)`

`Vector( x=x, y=y )` -> same as `Vector((x, y))`

Positional arguments, if they're given correctly, will override keyword arguments.

The `x` and `y` will override `coords`, wich will override `angle` and `len`.

You can add/substact two vectors together, or multiply/divide them by a scalar.

`vector.length()` -> return the distance from the origin to the extremity of the vector.

You can compare a vector to another or to a number *(the length of the vector(s) will be used)*.

`vector.xint()` -> return the integer part of the x-coordinate.

`vector.yint()` -> same, but with the y-coordinate.

`vector.as_tuple()` -> convert to a tuple.

`vector.as_int_tuple()` -> shortcut for `(vector.xint(), vector.yint())`.

`vector.is_equal_to(other)` -> with the `==` or the `!=` operators, two vectors will be compared by their length. use `is_equal_to` to test if they're *exactly* the same.