vector
- class Vector(x, y)
A simple 2d vector class, used to aid in developent and user experience.
- static from_other(vector: Union[Vector, PrimitiveVector], type_cast: Callable = <class 'float'>) Vector
Converts a PrimitiveVector into a
Vector
. Also handles the case where aVector
is already passed in, in which case that instance is simply returned. Otherwise, a newVector
is constructed, populated, and returned.- Parameters:
point – The PrimitiveVector
type_cast – The internal type to store data as.
- Returns:
A new
Vector
with the same position aspoint
.
- to_dict() dict
Convert this vector to a Factorio-parseable dict with “x” and “y” keys.
- Returns:
A dict of the format
{"x": x, "y": y}
.