Package motherhamster :: Module mathobj :: Class vec2d

Class vec2d



object --+
         |
        vec2d

2d vector class, supports vector and scalar operators, and also provides a bunch of high level functions

Instance Methods
 
__init__(self, x_or_pair, y=None)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
 
set(self, x, y)
 
__len__(self)
 
__getitem__(self, key)
 
__setitem__(self, key, value)
 
__repr__(self)
repr(x)
 
__eq__(self, other)
 
__ne__(self, other)
 
__nonzero__(self)
 
__add__(self, other)
 
__radd__(self, other)
 
__iadd__(self, other)
 
__sub__(self, other)
 
__rsub__(self, other)
 
__isub__(self, other)
 
__mul__(self, other)
 
__rmul__(self, other)
 
__imul__(self, other)
 
__div__(self, other)
 
__rdiv__(self, other)
 
__idiv__(self, other)
 
__floordiv__(self, other)
 
__rfloordiv__(self, other)
 
__ifloordiv__(self, other)
 
__truediv__(self, other)
 
__rtruediv__(self, other)
 
__itruediv__(self, other)
 
__mod__(self, other)
 
__rmod__(self, other)
 
__divmod__(self, other)
 
__rdivmod__(self, other)
 
__pow__(self, other)
 
__rpow__(self, other)
 
__lshift__(self, other)
 
__rlshift__(self, other)
 
__rshift__(self, other)
 
__rrshift__(self, other)
 
__and__(self, other)
 
__rand__(self, other)
 
__or__(self, other)
 
__ror__(self, other)
 
__xor__(self, other)
 
__rxor__(self, other)
 
__neg__(self)
 
__pos__(self)
 
__abs__(self)
 
__invert__(self)
 
get_length_sqrd(self)
 
get_length(self)
 
rotate(self, angle_degrees)
 
rotated(self, angle_degrees)
 
get_angle(self)
 
get_angle_between(self, other)
 
normalized(self)
 
normalize(self)
 
normalize_return_length(self)
 
perpendicular(self)
 
perpendicular_normal(self)
 
dot(self, other)
 
get_distance(self, other)
 
get_dist_sqrd(self, other)
 
projection(self, other)
 
cross(self, other)
 
interpolate_to(self, other, range)
 
convert_to_basis(self, x_vector, y_vector)
 
__getstate__(self)
 
__setstate__(self, dict)

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

Properties
  length
gets or sets the magnitude of the vector
  angle
gets or sets the angle of a vector
  x
  y

Inherited from object: __class__

Method Details

__init__(self, x_or_pair, y=None)
(Constructor)

 
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
Overrides: object.__init__
(inherited documentation)

__repr__(self)
(Representation operator)

 
repr(x)
Overrides: object.__repr__
(inherited documentation)

Property Details

length

gets or sets the magnitude of the vector
Get Method:
motherhamster.mathobj.vec2d.get_length(self)
Set Method:
motherhamster.mathobj.vec2d.__setlength(self, value)

angle

gets or sets the angle of a vector
Get Method:
motherhamster.mathobj.vec2d.get_angle(self)
Set Method:
motherhamster.mathobj.vec2d.__setangle(self, angle_degrees)