6 return list(map(op, a, b))
17 return "NVector(%s)" %
", ".join(map(str, self))
26 return type(self)(*
vop(operator.add, self.
componentscomponents, other.components))
29 return type(self)(*
vop(operator.sub, self.
componentscomponents, other.components))
32 if isinstance(scalar, NVector):
33 return type(self)(*
vop(operator.mul, self.
componentscomponents, scalar.components))
34 return type(self)(*(c * scalar
for c
in self.
componentscomponents))
37 return type(self)(*(c / scalar
for c
in self.
componentscomponents))
48 if isinstance(scalar, NVector):
62 if isinstance(key, slice):
70 return self.
componentscomponents == other.components
80 return sum(map(operator.mul, self.
componentscomponents, other.components))
86 return self * (1-t) + other * t
113 return type(self)(*
vop(operator.mul, self.
componentscomponents, other.components))
117 @pre len(self) == len(other) == 3
122 a[1] * b[2] - a[2] * b[1],
123 a[2] * b[0] - a[0] * b[2],
124 a[0] * b[1] - a[1] * b[0],
132 return math.atan2(self.
yyy, self.
xxx)
148 return NVector(length * math.cos(theta), length * math.sin(theta))
def __iadd__(self, other)
def __itruediv__(self, scalar)
def element_scaled(self, other)
def __getitem__(self, key)
def __init__(self, *components)
def __setitem__(self, key, value)
def __mul__(self, scalar)
def __imul__(self, scalar)
def __truediv__(self, scalar)
def __isub__(self, other)
def PolarVector(length, theta)