Package springbots :: Module vector :: Class Vector
[hide private]

Class Vector

source code


Vector class: Objects of this class have several of 2D vector implementations such dot product, adding, project and angle. It also overloads many commom math operator

Instance Methods [hide private]
 
__init__(self, a=0, b=0)
Creates a new vector
source code
 
__getitem__(self, index) source code
 
__add__(self, other) source code
 
__sub__(self, other) source code
 
__mul__(self, other) source code
 
__rmul__(self, other) source code
 
__div__(self, other) source code
 
__neg__(self) source code
 
__abs__(self) source code
 
__repr__(self)
repr(x)
source code
 
__str__(self)
str(x)
source code
 
__pow__(self, y, z=None) source code
 
dot(self, vector)
Return the dot product of two vectors
source code
 
cross(self, vector)
Return the cross product of two vectors
source code
 
length(self)
Return the vector's length
source code
 
perpendicular(self)
Return the vector that is perpenticular of this
source code
 
unit(self)
Return the vector's unit(length one)
source code
 
projection(self, vector)
Return the projection of this vector on another
source code
 
angle(self, vector=None)
Return the angle created by this vector and another of the vector (1,0) if given None
source code
 
angle_in_degrees(self, vector=None)
Return the angle created by this vector and another of the vector (1,0) if given None.
source code

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, a=0, b=0)
(Constructor)

source code 

Creates a new vector

Overrides: object.__init__

__repr__(self)
(Representation operator)

source code 

repr(x)

Overrides: object.__repr__
(inherited documentation)

__str__(self)
(Informal representation operator)

source code 

str(x)

Overrides: object.__str__
(inherited documentation)

angle_in_degrees(self, vector=None)

source code 

Return the angle created by this vector and another of the vector (1,0) if given None. Angle in degrees