pythagoras.r3.vector module¶
- class pythagoras.r3.vector.Vector3D(x: float, y: float, z: float)[source]¶
Bases:
objectThree-dimensional vector with common operations.
- Variables:
x (float) – \(x\) component of the vector.
y (float) – \(y\) component of the vector.
z (float) – \(z\) component of the vector.
- classmethod cylindrical(r: float, theta: float, z: float) Self[source]¶
Constructs a vector expressed in cylindrical coordinates.
- Parameters:
r – Magnitude of the projection of the vector onto the \(xy\) plane.
theta – Angle of the projection onto the \(xy\) plane with respect to the positive \(x\)-axis.
z – \(z\) component of the vector.
- Returns:
The corresponding vector.
- classmethod from_two_points(p1: tuple[float, float, float], p2: tuple[float, float, float]) Self[source]¶
Constructor for the vector that joins two points.
- Parameters:
p1 – Initial point.
p2 – End point.
- Returns:
The vector that goes from
p1top2.
- classmethod spherical(rho: float, phi: float, theta: float) Self[source]¶
Constructs a vector expressed in spherical coordinates.
- Parameters:
rho – Magnitude of the vector.
phi – Angle formed with the positive \(z\) axis.
theta – Angle of the projection onto the \(xy\) plane with respect to the positive \(x\)-axis.
- Returns:
The corresponding vector.
- property unitary: Self¶
Vector normalized to have unit norm.
- x: float¶
- y: float¶
- z: float¶