Skip to main content

Simple immutable vectors.

Project description

Package: generalvector

Vectors, featuring Vec and Vec2, inspired by Expression 2* in Wiremod inside Garry's Mod.

The vectors are immutable, so any time a value inside one is changed it returns a new vector.

The bulk of the code is written twice, with one verion in vector and one version in vector2. I've begun adding new functions into general instead which both vectors inherit from, to make the code DRY. The GeneralVector class can take an arbitrary amount of axis which allows us to easily add, for example, a Vec4 in the future if all code is moved to general.

*https://github.com/wiremod/wire/wiki/Expression-2

Installation

pip install generalvector

Usage example

from generalvector import Vec, Vec2
assert Vec(3) + 2 == Vec(5, 5, 5)
assert Vec2(3, 4).length() == 5

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

generalvector-1.3.0.tar.gz (7.6 kB view hashes)

Uploaded Source

Built Distribution

generalvector-1.3.0-py3-none-any.whl (10.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page