|        |   | 
- __builtin__.object
 - 
- Axis3d
 - Vector2d
 - Vector3d
  
 
 
 
 
  
class Axis3d(__builtin__.object) |  
    
|     | 
Axis3d class that define a coordinate axis system with origin and axis vectors   |  
|   | 
Methods defined here: 
- __init__(self, origin=vector.Vector3d(0.0000e+00 , 0.0000e+00, 0.0000e+00), u1_or_axis=vector.Vector3d(1.0000e+00 , 0.0000e+00, 0.0000e+00), u2=vector.Vector3d(0.0000e+00 , 1.0000e+00, 0.0000e+00), u3=vector.Vector3d(0.0000e+00 , 0.0000e+00, 1.0000e+00))
 - Constructor for Axis3d
 
param origin Vector3d the nex axis origin (defaults to (0,0,0)) 
param u1_or_axis the u1 unit vector, (defaults to (1,0,0)) 
param u2 Vector3d u2 unit vector (defaults to (0,1,)) 
param u3 Vector3d u3 unit vectors (defaults to (0,0,1) 
OR 
u1_or_axis list[] of three vectors 
  
Note:      supplied u_i vectors will be automatically normalsied  
- __repr__(self)
 - Implement the repr() method to show state of axis"
  
- transform(self, vec)
 - Method to transform a Vectors3d into this axis
 
param vec Vector3d to be transformned 
return new Vector3d in the new axis  
 
Data descriptors defined here: 
- __dict__
 
- dictionary for instance variables (if defined)
 
 
- __weakref__
 
- list of weak references to the object (if defined)
 
 
 |    
 
  
class Vector2d(__builtin__.object) |  
    
|     | 
Class to implement two dimensional vector manipulation.   |  
|   | 
Methods defined here: 
- __abs__(self)
 - Implement abs() method for vector2d
  
- __add__(self, b)
 - Method to implments the c = self + b to add 2 Vector2d, of b is a float it
 
will be added to each component. 
return new Vector2d  
- __div__(self, b)
 - Method to implemnt c = self / b for b being Vector 2d or float, if float it 
 
is appled to each component.  
returns Vector2d.  
- __ge__(self, b)
 - Implement abs(self> >= abs(b)
  
- __getitem__(self, key)
 - Implement indexing on read using [i] syntax.
  
- __gt__(self, b)
 - Implement abs(self) > abs(b)
  
- __iadd__(self, v)
 - Method to implement the += to add Vector2d to current in place, if v is a 
 
Vectord2d the components will be added, while if it is a float it will be  
added to each component.  
- __idiv__(self, v)
 - Method to implement the /= to divide current vector in place, if v is a 
 
Vectord2d the components will be divided, while if it is a float it will  
divide each component.  
- __imul__(self, v)
 - Method to implement the *= to multiply Vector2d by current in place, if v is a 
 
Vectord3d the component s will be multiplied, while if it is a float it will  
multiply each component.  
- __init__(self, x_or_v=0.0, y=0.0)
 - Constructor.
 
param x_or_v float x component (default = 0.0) 
param y float y component (default = 0.0) 
OR 
x_or_v Vector2d both componets copied 
OR 
x_or_v    list, [0] = x, [1] = y  
- __isub__(self, v)
 - Method to implement the -= to subtract Vector2d from current in place, if v is a 
 
Vectord2d the components will be subtrated, while if it is a float it will be  
subrtacted from each component.  
- __le__(self, b)
 - Implement abs(self) <= abs(b)
  
- __len__(self)
 - Implement len() to return 2
  
- __lt__(self, b)
 - Implement abd(self) < abs(b)
  
- __mul__(self, b)
 - Method to implemnt c = self * b for b being Vector 2d or float, if float it 
 
is appled to each component.  
returns Vector2d.  
- __neg__(self)
 - Method to implement the __neg__ method to return a new -ve vector.
 
Note current not changed.  
- __nonzero__(self)
 - Implment nonzero for logical test if Valid
  
- __radd__(self, b)
 - Method to implments the c = b + self to add 2 Vector2d, of b is a float it will 
 
be added to each component. 
return new Vector2d  
- __rdiv__(self, b)
 - Method to implemnt c = b / self for b being Vector 2d or float, if float 
 
it is appled to each component.  
returns Vector2d.  
- __repr__(self)
 - Implments repr() to return a string with full call.
  
- __rmul__(self, b)
 - Method to implemnt c = self * b for b being Vector 2d or float, if float 
 
it is appled to each component.  
returns Vector2d.  
- __rsub__(self, b)
 - Method to implments the c = b - self to add 2 Vector2d, of b is a float it 
 
will be added to each component. 
return new Vector2d  
- __setitem__(self, key, value)
 - Implement indexing on write using [i] syntax
  
- __str__(self)
 - Implement str() to return a string with components in 8.4e format.
  
- __sub__(self, b)
 - Method to implments the c = self - b to add 2 Vector2d, of b is a float it
 
will be added to each component. 
return new Vector2d  
- abs(self)
 - Return abs of vectors2d as a float.
  
- absCube(self)
 - Return the absCube of the Vector2d as a float defined as abs(x**3) + abs(y**3).
 
Does not use pow or **3  
- absNormalised(self)
 - Method to return length f vector and normalsied vector as a pair
  
- absSquare(self)
 - Return the absSquare of the vector2d as a float. Does not use pow or **2
  
- angleBetween(self, b)
 - Method to get the angle between two Vector2d
 
param b second Vector2d 
param return float, angle in range -pi/2 and pi 
Note: is abs(current) and abs(b) is zero, zero is retunned  
- copy(self)
 - Return a copy of the current Vector2d.
  
- distance(self, b)
 - Method to get distance between two Vector2ds Note does NOT use **2 or pow
 
param b the second Vector2d 
return float the square of the distance between vectors.  
- distanceCube(self, b)
 - Method to get distanceCube between two Vector2ds Note does NOT use **2 or pow
 
param b the second Vector2d 
return float the square of the distance between vectors.  
- distanceSquare(self, b)
 - Method to get distanceSquare between two Vector2ds Note does NOT use **2 or pow
 
param b the second Vector2d 
return float the square of the distance between vectors.  
- dot(self, b)
 - Method to get .dot product between current and specified Vector3d
 
b second Vector2d 
return float the dot product  
- errorSquare(self, b)
 - Method to set the normalsied square error between two vectors
  
- getComplex()
 - Return a copy of the vector as a complex(x,y)
  
- inverseSquare(self, b)
 - Method to get the vector from current to b scaled to inverse square of
 
the distance between them, for implementation of inverse square law forces.  
- isValid(self)
 - Method to deterime if Vector2d is valid, so .x != Nan
  
- negate(self)
 - Method to negate the current vector in place, will return self to can be used in chain.
  
- normalise(self)
 - Method to normalised vector in place. Will return selfso can be used in chain.
 
Note: if current vector is abs() = 0, the current vector will be set inValid()  
- polar(self)
 - Return a copy of the current vector in polar (r,theta) form
  
- rect(self)
 - Return a copy of the current vector in rect (x,y) form assumeing it is in 
 
polar (r,theta) form. 
  
Note: there is NO checking, so if the current Vector is NOT in polar form  
you will get rubbish.  
- rotate(self, gamma)
 - Method to implementate a rotation in place.
 
param gamma rotatian angle.  
- round(self, figs=0)
 - Method to round the current Vector2d to number of decimal figures.
 
param figs number of figures to round to (default is 0)  
- set(self, x_or_v=0.0, y=0.0)
 - Method to set componets of the vector in various formats.
 
param x_or_v float x component (default = 0.0) 
param y float y component (default = 0.0) 
OR 
x_or_v Vector2d both componets copied 
OR 
x_or_v    list, [0] = x, [1] = y  
- setInvalid(self)
 -  Method to set to invalid current vector2d to Invalid by setting both compoents 
 
to float("nan")  
- setLength(self, d)
 - Method to set the length of a vector to specified length. Will return self.
 
param d float length vector is set to.  
 
Data descriptors defined here: 
- __dict__
 
- dictionary for instance variables (if defined)
 
 
- __weakref__
 
- list of weak references to the object (if defined)
 
 
 |    
 
  
class Vector3d(__builtin__.object) |  
    
|     | 
Class to implement three  dimensional vector manipulation.   |  
|   | 
Methods defined here: 
- __abs__(self)
 - Implement abs() to return the abs length of Vector3d as a float.
  
- __add__(self, b)
 - Implement c = self + b for Vector3d, if b is float, then it will be added to 
 
each component. 
returns new Vector3d  
- __div__(self, b)
 - Implement c = self / b for Vector3d, if b is float it will divide each element
  
- __ge__(self, b)
 - Implement >= to compare abs() of each vector
  
- __getitem__(self, key)
 - Implement indexing on read in [i] syntax.
  
- __gt__(self, b)
 - Implement > to compare abs() of each vectors
  
- __iadd__(self, v)
 - Method to implement the += to add Vector3d to current in place, if v is a 
 
Vectord3d the components will be added, while if it is a float it will be  
added to each component.  
- __idiv__(self, v)
 - Method to implement the /= to divide current vector in place, if v is a 
 
Vectord3d the components will be devided, while if it is a float it will  
divide each component.  
- __imul__(self, v)
 - Method to implement the *= to multiply Vector3d by current in place, if v is a 
 
Vectord3d the components will be multiplied, while if it is a float it will  
multiply each component.  
- __init__(self, x_or_v=0.0, y=0.0, z=0.0)
 - Constructor to create and set vector.
 
param x_or_v  float  x component (default = 0.0) 
param  y float y component (default = 0.0) 
param  z float z component (default = 0.0) 
OR 
param x_or_v    Vector3d, all three componets copied 
OR 
param x_or_v  list, [0] = 1, [1] = y, [2] = z  
- __isub__(self, v)
 - Method to implement the -= to subtract Vector3d from current in place, if v is 
 
a Vectord3d the components will be subtrated, while if it is a float it will 
be subrtacted from each component.  
- __le__(self, b)
 - Implement <= to compare abs() of each vector.
  
- __len__(self)
 - Get len() defined at 3
  
- __lt__(self, b)
 - Implement < to compare abs() of each vector.
  
- __mul__(self, b)
 - Implement c = self * b for Vectors3d, if b is float it will multiply each element.
 
return new Vector3d  
- __neg__(self)
 - Implement the __neg__ method to return a new vector being the -ve of the current. 
 
Note current not changed.  
- __nonzero__(self)
 - Implement the logical no-zero test if a vector is valid. True is self.n != Nan
  
- __radd__(self, b)
 - Impement c = b + self for b not a Vector3d, (typically a float)
 
returns new Vector3d  
- __rdiv__(self, b)
 - Implement c = b / self for Vector3d, if b is float it will divide each element
  
- __repr__(self)
 - Impment repr() with class name and components formatted with 8.4e
  
- __rmul__(self, b)
 - Implement c = b * self for Vector3d, if b is float it will multiply each element.
  
- __rsub__(self, b)
 - Implement c = b - self for Vector3d, if b is float it will be subtracted 
 
from each element. 
returns new Vector3d  
- __setitem__(self, key, value)
 - Implement indexing on write in s[i] syntax.
  
- __str__(self)
 - Implement str() with components formatted with 8.4e
  
- __sub__(self, b)
 - Implement c = self - b for Vector3d, if b is float it will be subtracted 
 
from each element. 
returns new Vector3d  
- abs(self)
 - Return the abs of the Vector3d as a float.
  
- absCube(self)
 - Return the absCube of the Vector3d as a float defined as 
 
abs(x**3) + abs(y**3) + abs(z**3). Note does NOT use pow or **3  
- absNormalised(self)
 - Method to return abs() and normalsied copy of current vector as a 
 
list pair (current vector not changed) 
return [a,n] where a abs() and n is normalsied Vector3d  
- absSquare(self)
 - Return the absSquare of the vector3d as a float. Note does NOT use pow or **2
  
- angleBetween(self, b)
 - Method to get the angle between two Vector3d
 
param b Vector3d second Vector3d 
return float, angle in range -pi/2 and pi 
Note: is abs(current) and abs(b) is zero, zero is returned.  
- areaBetween(self, b)
 - Method to get the area between two Vectors3d defined by a = 0.5 * abs (self x b)
 
param b Vector3d second Vector3d 
return float, area defined by triangle formed by the two vectors  
- copy(self)
 - Return a copy of the current Vector3d.
  
- cross(self, b)
 - Method to form the cross product c = self x b
 
return Vector3d the cross product  
- distance(self, b)
 - Method to det the distance between two Vector3d
 
param b second Vector3d 
return float distance between two vectors.  
- distanceCube(self, b)
 - Method to get distanceCube between two Vector3d, defined by sum |a.i - b.i|^3. 
 
Note does NOT use **2 or pow. 
param b the second Vector3d 
return float the cube of the distance between vectors.  
- distanceSquare(self, b)
 - Method to get distanceSquare between two Vector3d, Note does NOT use **2 or pow.
 
param b the second Vector3d 
return float the square of the distance between vectors  
- dot(self, b)
 - Method to form the .dot product of self . b 
 
returns float the dot product.  
- errorSquare(self, b)
 - Method to get the normalsied square error between two Vector3d 
 
param b Vector3d, the second vector 
return float the normalsied square error  
- inverseSquare(self, b)
 - Method to get the Vector3d from current to Vector3d b scaled by inverse square of
 
the distance between them, for implementation of inverse square law forces. 
Formula implements is        v = (b - self) |b - self |^3 
param b Vector3d, the second vector.  
returned Vectors3d the scaled vector  
- isValid(self)
 - Method to test if vector is Valid
 
returns True for Valid, else False  
- negate(self)
 - Method to negate the current vector in place.
  
- normalise(self)
 - Method to normalised vector in place.
 
  
Note: if abs() = 0, the current vector will be set inValid()  
- polar(self)
 - Return a copy of current vector in polar (r,theta,psi) form.
  
- propagate(self, d, u)
 - Return a new vectors that is self + d*u.
 
Added for efficency in options calcualations.  
- rect(self)
 - Return a copy of the current vector in rect (x,y,z) form from current assume to 
 
be in polar (r,theta,psi) form. 
Note: there is no error checking, so if the current Vector is NOT in polar  
form you will get rubbish.  
- rotate(self, alpha, beta, gamma)
 - Method to implmeent general Rotate about x , y, z in place. 
 
The rotation order is x,y then z. 
param alpha rotation about x axis in radians 
param beta rotation about y axis in radians 
param gamma rotation about z axis in radians  
- rotateAboutX(self, alpha)
 - Method to implementate rotation about x axis in place.
 
param alpha rotatian about x axis in radians  
- rotateAboutY(self, beta)
 - Method to implementate a rotation about y axis in place.
 
param beta rotatian about y axis in radians.  
- rotateAboutZ(self, gamma)
 - Method to implementate a rotation about z axis in place.
 
param gamma rotatian about z axis in radians.  
- round(self, figs=0)
 - Method to round the current Vector2d to number of decimal figures.
 
param figs number of figures to round to (default is 0)  
- set(self, x_or_v=0.0, y=0.0, z=0.0)
 - Method to set vector with various augument types.
 
param x_or_v  float  x component (default = 0.0) 
param  y float y component (default = 0.0) 
param  z float z component (default = 0.0) 
OR 
param x_or_v    Vector3d, all three componets copied 
OR 
param x_or_v  list, [0] = 1, [1] = y, [2] = z  
- setInvalid(self)
 - Method to set current vector3d to Invalid by setting all three 
 
compoents to float("nan").  
- setLength(self, d)
 - Method to set the length (or abs) of the current vector to specified length 
 
by scaling. 
param d float length vector is set to.  
 
Data descriptors defined here: 
- __dict__
 
- dictionary for instance variables (if defined)
 
 
- __weakref__
 
- list of weak references to the object (if defined)
 
 
 |    |