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://travis-ci.org/kxgames/vecrec.svg?branch=master

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.0.tar.gz (116.4 kB view details)

Uploaded Source

File details

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

File metadata

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

File hashes

Hashes for vecrec-0.2.0.tar.gz
Algorithm Hash digest
SHA256 fd140cb896589ade6963eef31e031403ebccb1aba88db555909cb14112446b41
MD5 fa39f9c3f2b864f7e14ee3b08e5e8f5c
BLAKE2b-256 1bc5fd6b08531beef0398eddde4ec0f3ccbbe6f87817e289797c37b2c1415a77

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