Пример #1
0
	def normalize( self ):
		"Normalizes the vector"

		length = breveInternal.vectorLength( self )

		if length != 0.0:
			return breveInternal.scaleVector( self, 1.0 / length )
Пример #2
0
    def normalize(self):
        "Normalizes the vector"

        length = breveInternal.vectorLength(self)

        if length != 0.0:
            return breveInternal.scaleVector(self, 1.0 / length)
Пример #3
0
	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 )
Пример #4
0
    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)
Пример #5
0
	def scale( self, other ):
		"Scales the vector by a scalar"
		return breveInternal.scaleVector( self, -1 )
Пример #6
0
	def __neg__( self ):
		return breveInternal.scaleVector( self, -1 )
Пример #7
0
	def __div__( self, other ):
		return breveInternal.scaleVector( self, 1.0 / other )
Пример #8
0
 def scale(self, other):
     "Scales the vector by a scalar"
     return breveInternal.scaleVector(self, other)
Пример #9
0
 def __neg__(self):
     return breveInternal.scaleVector(self, -1)
Пример #10
0
 def __div__(self, other):
     return breveInternal.scaleVector(self, 1.0 / other)