algebra_3D.Vector.op

Vector.op()

Operator redefinition for the class Point.

Parameters

Type

Description

B

Vector

The second member as a Vector

op

string

the operator to execute

Returns
Vector

The computed vector operation

Examples

>>> v=Vector(0,0,0,2,2,2)
>>> w=Vector(1,1,1,4,4,4)
>>> print(v.op(w,'+'))
 ( 5.0 , 5.0 , 5.0 )
printed
>>> print(v.op(w,'-'))
 ( -1.0 , -1.0 , -1.0 )
printed
>>> p=Point(1,2,3)
>>> print(v.op(p,'*'))
 ( 2.0 , 4.0 , 6.0 )
printed
>>> print(v.op(10,'*'))
 ( 20.0 , 20.0 , 20.0 )
printed