ROX Vectors
A lightweight and simple 2D vector class for Python, providing essential vector operations, geometric transformations, and utility functions. Perfect for mathematical simulations and robotics.
Features
- Basic Vector Operations: Addition, subtraction, multiplication, division, negation.
- Geometric Properties: Vector length, angle, normalization, and perpendicular vectors.
- Transformation Utilities: Translation and rotation.
- Dot and Cross Product calculations.
- Line Segment manipulation and properties.
Installation
pip install rox-vectors
Usage Examples
Creating Vectors
from rox_vectors import Vector
v1 = Vector(3, 4)
v2 = Vector(1, 2)
print(v1) # (3.000, 4.000)
print(v2) # (1.000, 2.000)
Basic Operations
v3 = v1 + v2 # (4.000, 6.000)
v4 = v1 - v2 # (2.000, 2.000)
v5 = v1 * 2 # (6.000, 8.000)
v6 = v1 / 2 # (1.500, 2.000)
v7 = -v1 # (-3.000, -4.000)
Geometric Properties
length = v1.r # 5.0
angle = v1.phi # 0.927 (in radians)
v8 = v1.u # (0.600, 0.800)
v9 = v1.v # (-0.800, 0.600)
Dot and Cross Products
dot_product = v1.dot(v2) # 11.0
cross_product = v1.cross(v2) # 2.0
Vector Transformation
v10 = v1.translate(2, 3) # (5.000, 7.000)
v11 = v1.rotate(math.radians(90)) # (-4.000, 3.000)
Line Segment
from rox_vectors import Line
line = Line(Vector(0, 0), Vector(1, 1))
line.shift_y(1)
print(line) # <Line(start=(0.000,1.000), end=(1.000,2.000))>
line_angle = line.phi # 0.785 (in radians)
Distance and Projection Utilities
from rox_vectors import point_on_line, distance_to_line, distance_to_b
a = Vector(0, 0)
b = Vector(4, 4)
x = Vector(2, 3)
projection = point_on_line(a, b, x) # (2.500, 2.500)
distance = distance_to_line(a, b, x) # 0.707
distance_b = distance_to_b(a, b, x) # -0.707
Development
-
Init host system with
init_host.sh. This will build a dev image. -
Launch in VSCode devcontainer.
-
develop and test in devcontainer (VSCode)
-
trigger ci builds by bumping version with a tag. (see
.gitlab-ci.yml)
Tooling
- Automation:
invoke- runinvoke -lto list available commands. (usestasks.py) - Verisoning :
setuptools_scm - Linting and formatting :
pylint - Typechecking:
mypy
What goes where
src/rox_vectorsapp code.pip install ..tasks.pyautomation tasks..gitlab-ci.ymltakes care of the building steps.
Metadata
Release files for rox-vectors 0.2.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| rox_vectors-0.2.3.tar.gz | 13.1 kB | Without provenance | Details for rox_vectors-0.2.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| rox_vectors-0.2.3-py3-none-any.whl | Python 3 | none | any | Details for rox_vectors-0.2.3-py3-none-any.whl |
Total release size: 19.2 kB
Release files / rox_vectors-0.2.3.tar.gz
| Download URL | rox_vectors-0.2.3.tar.gz |
|---|---|
| Size | 13.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2bf5042c70d39172ac69d8efad7a0076a77c5ee5001bb5ac9ca02c822f743aaf
|
|
BLAKE2b-256 checksum How to use checksums |
4df60b8caad8679043976edd9129d21a6c686e1ef8b3bc04a6ab2dff2da5a579
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.3
|
Release files / rox_vectors-0.2.3-py3-none-any.whl
| Download URL | rox_vectors-0.2.3-py3-none-any.whl |
|---|---|
| Size | 6.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
03bbd7f894cadc8cd11637152e6d2d928b6d41eb757070e1b4c8bf01ed953966
|
|
BLAKE2b-256 checksum How to use checksums |
a5e4cbb729bf5cf9f2fa75fe3292f68da06d37a7307850053d4489ccaa3eb8ea
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.3
|
Security for rox-vectors 0.2.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.