def __init__(
self,
x: Union[int, float, 'Vec', Iterable[float]]=0.0,
y: float=0.0,
z: float=0.0,
) -> None:
"""Create a Vector.
All values are converted to Floats automatically.
If no value is given, that axis will be set to 0.
An iterable can be passed in (as the x argument), which will be
used for x, y, and z.
"""
if isinstance(x, (int, float)):
self.x = float(x)
self.y = float(y)
self.z = float(z)
else:
it = iter(x)
self.x = float(next(it, 0.0))
self.y = float(next(it, y))
self.z = float(next(it, z))
评论列表
文章目录