Skip to main content

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.

https://img.shields.io/pypi/v/vecrec.svg https://img.shields.io/pypi/pyversions/vecrec.svg https://img.shields.io/travis/kxgames/vecrec.svg https://img.shields.io/coveralls/kxgames/vecrec.svg https://readthedocs.org/projects/vecrec/badge/?version=latest

Installation

The vecrec module is pure-python, dependency-free, and available from PyPI:

$ pip install vecrec

Basic Usage

In lieu of complete API documentation, here are a few examples showing how to construct and use 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

vecrec-0.2.1.tar.gz (118.7 kB view details)

Uploaded Source

File details

Details for the file vecrec-0.2.1.tar.gz.

File metadata

  • Download URL: vecrec-0.2.1.tar.gz
  • Upload date:
  • Size: 118.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for vecrec-0.2.1.tar.gz
Algorithm Hash digest
SHA256 d96ddc89ac6730c22b08474437a9637ee2a5fecd686969719205801223aae7bf
MD5 b55650b87e92f22f9c10ede8cabe2c67
BLAKE2b-256 435b8da6ec2a322b5e72ac33fdbfd52f8c510b92373038f74bb72aa7e24cc560

See more details on using hashes here.

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