Skip to main content

Introduces a new datatype called Vector for convinient working with vectors

Project description

This module makes working with vectors (or other tuple-ish things) much more convinient.

It introduces a new datatype (actually a class) called Vector which is a lot like tuples.

These vectors can contain from 1 to 4 dimensions (x, y, z, t) and these can be called and changed easily.

The addition (and subtraction, multiplication and so on) of a vector, integer, float or list to another vector is as easy as working with integers and floats. See below, or example.py for examples. (example.py is far more detailed.)

No more annoying iteration and inefficient code whilts working with tuples thanks to this module!

>>> from vectors import *
>>> myvector = Vector(1,2,3)
>>>
>>> print(myvector)
(1, 2, 3)
>>> print(myvector.x)
1
>>> print(myvector[0])
1
>>> print(myvector.type)
'vector3'
>>> print(vtype(myvector))
'vector3'
>>>
>>> myvector += 1
(2, 3, 4)
>>>
>>> othervector = Vector(4, 5, 6)
>>>
>>> myvector + othervector
(6, 7, 10)
>>> myvector / [3, 2, 0.5]
(2, 3.5, 20)
>>>
>>> mytuple = unv(myvector)
>>> print(mytuple, type(mytuple))
(2, 3.5, 20), <class 'tuple'>
>>>
>>> myvec = Vector(mytuple)
>>>
>>> mymag = mag(myvec)
'returns magnitude'
>>> mynorm = normalized(myvec)
'returns normalized vector'
>>> print(myvec.positive())
'returns all-positive vector'

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

easyvectors-1.0.2.tar.gz (5.7 kB view details)

Uploaded Source

File details

Details for the file easyvectors-1.0.2.tar.gz.

File metadata

  • Download URL: easyvectors-1.0.2.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.7.3

File hashes

Hashes for easyvectors-1.0.2.tar.gz
Algorithm Hash digest
SHA256 2dcce5edf5c09c47c5945ff23d4bf5afdd068673d228f9684ad488181a048bac
MD5 3023fa67bf21768e3773a8b928fdca35
BLAKE2b-256 43cd6a898f059ad531206f157ca83468ca0f121c8fd3216d3891d7a60ffd0f97

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