iMilchshake / Vector2D

Python Vector2D Class

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Vector2D

Python Class representing a 2D Vector with convenient functions. Math, compare and string operators are overwritten.

Example

from Vector2D import Vector2D

a = Vector2D(2, 4)
b = Vector2D(1, -1)
c = a + b
print(c == Vector2D(3, 3))
print(c)

# output:
# >> True
# >> [3, 3]

Efficiency

Not quite as fast as tuples, but faster than using Numpy vectors. (see speed_comparison.py)

About

Python Vector2D Class


Languages

Language:Python 100.0%