395
395
z = property(_get_z, _set_z)
397
397
def dot(vec1, vec2):
398
""" Function performs the dot vector multiplication of 2
399
vector instances and returning a new vector instance equal to
400
the dot product of given vectors"""
398
""" Function performs the dot vector multiplication of 2
399
vector instances and returning a new vector instance equal to
400
the dot product of given vectors"""
407
407
def cross(vec1, vec2):
408
""" Function performing the cross vector multiplication of 2
409
vector instances and returning a new vector instance equal to
410
the cross product of given vectors"""
411
i = (vec1.y*vec2.z - vec1.z*vec2.y)
412
j = (vec1.z*vec2.x - vec1.x*vec2.z)
413
k = (vec1.x*vec2.y - vec1.y*vec2.x)
414
cross = MVector(i, j, k)
408
""" Function performing the cross vector multiplication of 2
409
vector instances and returning a new vector instance equal to
410
the cross product of given vectors"""
411
i = (vec1.y*vec2.z - vec1.z*vec2.y)
412
j = (vec1.z*vec2.x - vec1.x*vec2.z)
413
k = (vec1.x*vec2.y - vec1.y*vec2.x)
414
cross = MVector(i, j, k)
418
""" Function computes and returns the magnitude of a vector"""
419
mag = sqrt(vec[0]**2 + vec[1]**2 + vec[2]**2)
418
""" Function computes and returns the magnitude of a vector"""
419
mag = sqrt(vec[0]**2 + vec[1]**2 + vec[2]**2)
423
423
""" Function computes and returns the normalized form of a