|
def | __init__ (self, x, y=None, z=None) |
|
def | getX (self) |
|
def | getY (self) |
|
def | getZ (self) |
|
def | dot (self, rhs) |
|
def | cross (self, rhs) |
|
def | getLengthSquared (self) |
|
def | getLength (self) |
|
def | getNormalized (self) |
|
def | normalize (self) |
|
def | getProjectionOnto (self, rhs) |
|
def | getPerpendicularTo (self, rhs) |
|
def | getRotatedAroundNormalizedAxis (self, axis, angle) |
|
def | rotateAroundNormalizedAxis (self, axis, angle) |
|
def | isClose (self, rhs, relativeTolerance=None, absoluteTolerance=None) |
|
def | __eq__ (self, rhs) |
|
def | __ne__ (self, rhs) |
|
def | __add__ (self, rhs) |
|
def | __sub__ (self, rhs) |
|
def | __mul__ (self, rhs) |
|
def | __div__ (self, rhs) |
|
def | __truediv__ (self, rhs) |
|
def | __neg__ (self) |
|
def | __getitem__ (self, index) |
|
def | __repr__ (self) |
|
Represents a three-dimensional vector with the entries being real numbers.
Definition at line 7 of file Vector3DReal.py.
◆ __init__()
def MPCDAnalysis.Vector3DReal.Vector3DReal.__init__ |
( |
|
self, |
|
|
|
x, |
|
|
|
y = None , |
|
|
|
z = None |
|
) |
| |
The constructor.
@throw TypeError
Throws if the types of the arguments do not match the
specification.
@param[in] x
This parameter may be an instance of `Vector3DReal`, in which
case this instance will be constructed to contain the same
elements as `x`, and it will be required that `y` and `z` be
`None`.
Alternatively, `x` may be a list or tuple of length `3`, with
each element being either an `int` or a `float`; the element
`0` will be taken as the `x` value for this vector, the
element `1` as `y`, and the element `2` as `z`. In this case,
too, `y` and `z` must be `None`.
Alternatively, `x` may be an `int` or `float` and will serve
as the `x` value for this instance. In this case, `y` and `z`
must be set likewise.
@param[in] y
Either `None` or the `y` value for this vector; see the
documentation of `x`.
@param[in] z
Either `None` or the `z` value for this vector; see the
documentation of `x`.
Definition at line 37 of file Vector3DReal.py.
◆ __add__()
def MPCDAnalysis.Vector3DReal.Vector3DReal.__add__ |
( |
|
self, |
|
|
|
rhs |
|
) |
| |
Returns the sum of this instance and `rhs`.
@param[in] rhs
The right-hand-side instance, which must be of type
`Vector3DReal`.
Definition at line 371 of file Vector3DReal.py.
◆ __div__()
def MPCDAnalysis.Vector3DReal.Vector3DReal.__div__ |
( |
|
self, |
|
|
|
rhs |
|
) |
| |
Returns the ratio of this instance and `rhs`.
The division performed is always a floating-point division.
@param[in] rhs
The factor to divide by with, which must be either of type
`int` or `float`, and must not be `0`.
Definition at line 420 of file Vector3DReal.py.
◆ __eq__()
def MPCDAnalysis.Vector3DReal.Vector3DReal.__eq__ |
( |
|
self, |
|
|
|
rhs |
|
) |
| |
Returns `True` if `rhs` contains the same entries as this instance, and
`False` otherwise.
@param[in] rhs
The right-hand-side instance, which must be of type
`Vector3DReal`.
Definition at line 337 of file Vector3DReal.py.
◆ __getitem__()
def MPCDAnalysis.Vector3DReal.Vector3DReal.__getitem__ |
( |
|
self, |
|
|
|
index |
|
) |
| |
Returns the coordinate with the given index.
@param[in] index
The coordinate index, which must be `0` for the `x`
coordinate, `1` for `y`, or `2` for `z`.
Definition at line 467 of file Vector3DReal.py.
◆ __mul__()
def MPCDAnalysis.Vector3DReal.Vector3DReal.__mul__ |
( |
|
self, |
|
|
|
rhs |
|
) |
| |
Returns the product of this instance and `rhs`.
@param[in] rhs
The factor to multiply with, which must be either of type
`int` or `float`.
Definition at line 401 of file Vector3DReal.py.
◆ __ne__()
def MPCDAnalysis.Vector3DReal.Vector3DReal.__ne__ |
( |
|
self, |
|
|
|
rhs |
|
) |
| |
Returns the negation of `__eq__`.
@param[in] rhs
The right-hand-side instance, which must be of type
`Vector3DReal`.
Definition at line 358 of file Vector3DReal.py.
◆ __neg__()
def MPCDAnalysis.Vector3DReal.Vector3DReal.__neg__ |
( |
|
self | ) |
|
◆ __repr__()
def MPCDAnalysis.Vector3DReal.Vector3DReal.__repr__ |
( |
|
self | ) |
|
Returns a string representation of this instance.
Definition at line 485 of file Vector3DReal.py.
◆ __sub__()
def MPCDAnalysis.Vector3DReal.Vector3DReal.__sub__ |
( |
|
self, |
|
|
|
rhs |
|
) |
| |
Returns the difference of this instance and `rhs`.
@param[in] rhs
The right-hand-side instance, which must be of type
`Vector3DReal`.
Definition at line 386 of file Vector3DReal.py.
◆ __truediv__()
def MPCDAnalysis.Vector3DReal.Vector3DReal.__truediv__ |
( |
|
self, |
|
|
|
rhs |
|
) |
| |
Returns the ratio of this instance and `rhs`.
The division performed is always a floating-point division.
@param[in] rhs
The factor to divide by with, which must be either of type
`int` or `float`, and must not be `0`.
Definition at line 435 of file Vector3DReal.py.
◆ cross()
def MPCDAnalysis.Vector3DReal.Vector3DReal.cross |
( |
|
self, |
|
|
|
rhs |
|
) |
| |
Returns the cross product of this vector with `rhs`.
@param[in] rhs
The right-hand-side instance, which must be of type
`Vector3DReal`.
Definition at line 126 of file Vector3DReal.py.
◆ dot()
def MPCDAnalysis.Vector3DReal.Vector3DReal.dot |
( |
|
self, |
|
|
|
rhs |
|
) |
| |
Returns the dot product of this vector with `rhs`.
@param[in] rhs
The right-hand-side instance, which must be of type
`Vector3DReal`.
Definition at line 111 of file Vector3DReal.py.
◆ getLength()
def MPCDAnalysis.Vector3DReal.Vector3DReal.getLength |
( |
|
self | ) |
|
◆ getLengthSquared()
def MPCDAnalysis.Vector3DReal.Vector3DReal.getLengthSquared |
( |
|
self | ) |
|
Returns the square of the length of this vector.
Definition at line 140 of file Vector3DReal.py.
◆ getNormalized()
def MPCDAnalysis.Vector3DReal.Vector3DReal.getNormalized |
( |
|
self | ) |
|
Returns this vector, but normalized, i.e. divided by its length.
@throw ValueError
Throws if `getLengthSquared() == 0`.
Definition at line 161 of file Vector3DReal.py.
◆ getPerpendicularTo()
def MPCDAnalysis.Vector3DReal.Vector3DReal.getPerpendicularTo |
( |
|
self, |
|
|
|
rhs |
|
) |
| |
Returns the component of this vector that is perpendicular to `rhs`.
@throw ValueError
Throws if `rhs.getLengthSquared() == 0`.
@param[in] rhs
The right-hand-side instance, which must be of type
`Vector3DReal` and must not be of zero length.
Definition at line 220 of file Vector3DReal.py.
◆ getProjectionOnto()
def MPCDAnalysis.Vector3DReal.Vector3DReal.getProjectionOnto |
( |
|
self, |
|
|
|
rhs |
|
) |
| |
Returns the projection of this vector onto the direction `rhs`.
@throw ValueError
Throws if `rhs.getLengthSquared() == 0`.
@param[in] rhs
The right-hand-side instance, which must be of type
`Vector3DReal` and must not be of zero length.
Definition at line 198 of file Vector3DReal.py.
◆ getRotatedAroundNormalizedAxis()
def MPCDAnalysis.Vector3DReal.Vector3DReal.getRotatedAroundNormalizedAxis |
( |
|
self, |
|
|
|
axis, |
|
|
|
angle |
|
) |
| |
Returns the this vector, rotated around the normalized vector `axis` by
`angle` radians in counter-clockwise direction.
@throw ValueError
Throws if `axis.getLengthSquared() == 0`.
@param[in] axis
The vector to rotate about, which must be of type
`Vector3DReal` and is assumed to be of unit length.
@param[in] angle
The amount to rotate, in radians.
Definition at line 244 of file Vector3DReal.py.
◆ getX()
def MPCDAnalysis.Vector3DReal.Vector3DReal.getX |
( |
|
self | ) |
|
◆ getY()
def MPCDAnalysis.Vector3DReal.Vector3DReal.getY |
( |
|
self | ) |
|
◆ getZ()
def MPCDAnalysis.Vector3DReal.Vector3DReal.getZ |
( |
|
self | ) |
|
◆ isClose()
def MPCDAnalysis.Vector3DReal.Vector3DReal.isClose |
( |
|
self, |
|
|
|
rhs, |
|
|
|
relativeTolerance = None , |
|
|
|
absoluteTolerance = None |
|
) |
| |
Returns whether this instance and `rhs` are close to each other.
Two vectors are "close" in this sense if all of their components are
close in the sense of `numpy.allclose`.
@throw TypeError
Throws if any of the arguments have an invalid type.
@throw ValueError
Throws if any of the arguments have an invalid value.
@param[in] rhs
The other instance of `Vector3DReal` to compare to.
@param[in] relativeTolerance
A non-negative `float` that is passed as the `rtol` parameter
of `numpy.allclose`, or `None` for its default value.
@param[in] absoluteTolerance
A non-negative `float` that is passed as the `atol` parameter
of `numpy.allclose`, or `None` for its default value.
Definition at line 305 of file Vector3DReal.py.
◆ normalize()
def MPCDAnalysis.Vector3DReal.Vector3DReal.normalize |
( |
|
self | ) |
|
Normalizes this vector, i.e. divides it by its length.
@throw ValueError
Throws if `getLengthSquared() == 0`.
Definition at line 176 of file Vector3DReal.py.
◆ rotateAroundNormalizedAxis()
def MPCDAnalysis.Vector3DReal.Vector3DReal.rotateAroundNormalizedAxis |
( |
|
self, |
|
|
|
axis, |
|
|
|
angle |
|
) |
| |
Sets this vector to be the result of `getRotatedAroundNormalizedAxis`,
called with the given arguments.
@throw ValueError
Throws if `axis.getLengthSquared() == 0`.
@param[in] axis
The vector to rotate about, which must be of type
`Vector3DReal` and is assumed to be of unit length.
@param[in] angle
The amount to rotate, in radians.
Definition at line 274 of file Vector3DReal.py.
The documentation for this class was generated from the following file: