def normalize( self ): "Normalizes the vector" length = breveInternal.vectorLength( self ) if length != 0.0: return breveInternal.scaleVector( self, 1.0 / length )
def normalize(self): "Normalizes the vector" length = breveInternal.vectorLength(self) if length != 0.0: return breveInternal.scaleVector(self, 1.0 / length)
def __mul__( self, other ): if type( other ) == float or type( other ) == int: return breveInternal.scaleVector( self, other ) if other.__class__ == matrix: x = self[ 0 ] * other[ 0 ] + self[ 1 ] * other[ 1 ] + self[ 2 ] * other[ 2 ] y = self[ 0 ] * other[ 3 ] + self[ 1 ] * other[ 4 ] + self[ 2 ] * other[ 5 ] z = self[ 0 ] * other[ 6 ] + self[ 1 ] * other[ 7 ] + self[ 2 ] * other[ 8 ] return vector( x, y, z )
def __mul__(self, other): if type(other) == float or type(other) == int: return breveInternal.scaleVector(self, other) if other.__class__ == matrix: x = self[0] * other[0] + self[1] * other[1] + self[2] * other[2] y = self[0] * other[3] + self[1] * other[4] + self[2] * other[5] z = self[0] * other[6] + self[1] * other[7] + self[2] * other[8] return vector(x, y, z)
def scale( self, other ): "Scales the vector by a scalar" return breveInternal.scaleVector( self, -1 )
def __neg__( self ): return breveInternal.scaleVector( self, -1 )
def __div__( self, other ): return breveInternal.scaleVector( self, 1.0 / other )
def scale(self, other): "Scales the vector by a scalar" return breveInternal.scaleVector(self, other)
def __neg__(self): return breveInternal.scaleVector(self, -1)
def __div__(self, other): return breveInternal.scaleVector(self, 1.0 / other)