2D vector and rectangle classes.
Project description
This package provides 2D vector and rectangle classes. These classes were written to be used in games, so they have some methods that conveniently tie into pyglet and pygame, but for the most part they are quite general and could be used for almost anything.
Installation
The vecrec module is pure-python, dependency-free, and available from PyPI:
$ pip install vecrec
Basic Usage
Here are a few examples showing how to construct and use the Vector and Rect classes provided by this package:
>>> from vecrec import Vector, Rect >>> a = Vector(1, 2) >>> b = Vector(3, 4) >>> a + b Vector(4, 6)
Rectangles are more commonly constructed using factory methods:
>>> Rect.from_size(8, 11) Rect(0, 0, 8, 11) >>> Rect.from_center(a, 1, 1) Rect(0, 1, 1, 1)
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
Built Distribution
File details
Details for the file vecrec-0.3.1.tar.gz
.
File metadata
- Download URL: vecrec-0.3.1.tar.gz
- Upload date:
- Size: 18.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.25.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 96ff0f833f5ab548f08e720b99998d3a86ac8ce4ba50ae9aa35936d3338cf97f |
|
MD5 | e956a99df6d024b876c244eafc7a71d2 |
|
BLAKE2b-256 | 336b30a71d137a7b39e2295e5b4dc858e177437bc5bdc1d04ab2c604ba63b6dc |
File details
Details for the file vecrec-0.3.1-py2.py3-none-any.whl
.
File metadata
- Download URL: vecrec-0.3.1-py2.py3-none-any.whl
- Upload date:
- Size: 11.1 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.25.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9d4725d304e6c696c84f1503c47d0c1a5a957f25cdaa8c8724d8d739c11136a2 |
|
MD5 | 1698f03a1f7c0c104a7587fac8bdc709 |
|
BLAKE2b-256 | 305f2270eac805b788674704ed30b3b0f6e036b71744ff498e7878ce636c1eb8 |