| Home | Trees | Indices | Help |
|
|---|
|
|
Vector in 3D space
Constructor:
- Vector(|x|, |y|, |z|) (from three coordinates)
- Vector(|coordinates|) (from any sequence containing three coordinates)
Vectors support the usual arithmetic operations
('v1', 'v2': vectors, 's': scalar):
- 'v1+v2' (addition)
- 'v1-v2' (subtraction)
- 'v1*v2' (scalar product)
- 's*v1', 'v1*s' (multiplication with a scalar)
- 'v1/s' (division by a scalar)
The three coordinates can be extracted by indexing.
Vectors are *immutable*, i.e. their elements cannot be changed.
Vector elements can be any objects on which the standard
arithmetic operations plus the functions sqrt and arccos are defined.
|
|||
| __init__(self, x=None, y=None, z=None) | ||
| __getstate__(self) | ||
| __setstate__(self, state) | ||
| __copy__(self, memo=None) | ||
| __deepcopy__(self, memo=None) | ||
| __repr__(self) | ||
| __str__(self) | ||
| __add__(self, other) | ||
| __radd__(self, other) | ||
| __neg__(self) | ||
| __sub__(self, other) | ||
| __rsub__(self, other) | ||
| __mul__(self, other) | ||
| __rmul__(self, other) | ||
| __div__(self, other) | ||
| __rdiv__(self, other) | ||
| __cmp__(self, other) | ||
| __len__(self) | ||
| __getitem__(self, index) | ||
|
x(self) Returns the x coordinate. |
||
|
y(self) Returns the y coordinate. |
||
|
z(self) Returns the z coordinate. |
||
|
length(self) Returns the length (norm). |
||
|
normal(self) Returns a normalized copy. |
||
|
cross(self,
other) Returns the cross product with vector |other|. |
||
|
asTensor(self) Returns an equivalent tensor object of rank 1. |
||
|
dyadicProduct(self,
other) Returns the dyadic product with vector or tensor |other|. |
||
|
angle(self,
other) Returns the angle to vector |other|. |
||
|
|||
|
is_vector = 1
|
||
|
|||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|||
is_vectorNone
|
| Home | Trees | Indices | Help |
|
|---|
| Generated by Epydoc 3.0alpha3 on Fri Nov 2 14:06:04 2007 | http://epydoc.sourceforge.net |