A package to work with 3D vectors in Spherical and Cartesian coordinates.
Project description
threedvector Package
threedvector is a package providing common methods for working with 3D vectors in both Spherical and Cartesian coordinates.
Vectors are stored in Spherical format but can be created in both Spherical and Cartesian formats.
Methods
copy(other)
Returns a Vector object representing a copy of other
Instance Methods
init(radius_x=0, theta_y=0, phi_z=0, coords="spherical")
Default Vector creation is in the Spherical coordinate system where coords is set to "spherical". radius_x represents the length of the vector, theta_y the polar angle, theta and phi_z the azimuthal angle, phi.
A Vector can be created using Cartesian coordinates with coords set to "cartesian" instead of "spherical". In this case radius_x represents the x coordinate, theta_y the y coordinate and phi_z the z coordinate.
cartesian()
Returns a list in the form of [x, y, z] representing the corresponding Cartesian coordinates of a vector.
is_same(s_vector)
Compares the length as well as angles theta and phi of vector with s_vector to determine equality. This is different to '=' which only checks for equality of the vector length.
dot(s_vector)
Returns a float as the resultant dot product of a vector with s_vector.
cross(s_vector)
Returns the Vector object resulting from the cross product of a vector with s_vector.
angle(s_vector)
Returns a float as the in-plane angle in degrees between a vector and s_vector.
unit()
Returns a Vector object as the corresponding unit vector of a vector.
magnitude()
Returns a float as the length of a vector
theta()
Returns a float as the polar angle theta of a vector in degrees
phi()
Returns a float as the azimuthal angle phi of a vector in degrees
set_magnitude(magnitude)
Sets the length of a vector to magnitude
set_theta(theta)
Sets the polar angle, theta, of a vector to theta in degrees
set_phi(phi)
Sets the azimuthal angle, phi, of a vector to phi in degrees
addition and subtraction
Returns resulting Vector object. Normal addition and subtraction are done through Cartesian addition and subtraction operations.
multiplication
Multiplication is implemented as scalar multiplication only. For dot and cross products, the corresponding methods should be used.
comparison
All comparison operators return comparison with length of vectors only.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file threedvector-0.3.3.tar.gz.
File metadata
- Download URL: threedvector-0.3.3.tar.gz
- Upload date:
- Size: 3.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6975d3459340a125b7cc40fc7d98de22cdd000c836f9896e9170ce71e58fd0a3
|
|
| MD5 |
54ddd6b5a58213118273b517b0b6598f
|
|
| BLAKE2b-256 |
209f2b79093eb5410b347584dd22f59b725cfe1b6e4297587f6a77941b94eafd
|
File details
Details for the file threedvector-0.3.3-py3-none-any.whl.
File metadata
- Download URL: threedvector-0.3.3-py3-none-any.whl
- Upload date:
- Size: 5.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1f4effd6391e139d75e9baeb63244ee1aab7670f25da25884c0de36c8fdb0eee
|
|
| MD5 |
8f92ac92ac6d8dd1e041cd8b812b0b1f
|
|
| BLAKE2b-256 |
f2692e2f5f8fd7a09362388c3b873354b2a332c55cf5cb6e63da536d792102f4
|