Hexagonal provides hexagonal vectors.
Project description
Hexagonal
hexagonal
provides hexagonal vectors.
Usage
>>> import hexagonal
Create a vector from cube coordinates, with x + y + z = 0. x is south-east-ish, y is north and z is south-west-ish.
>>> v = hexagonal.Vec(x=4, y=3, z=-7)
>>> v
Vec(4, 3, -7)
Coordinates can be accessed, but not modified. hexagonal.Vec
is
immutable.
>>> v.x
4
>>> v.y
3
>>> v.z
-7
The z
coordinate is optional.
>>> u = hexagonal.Vec(4, 5)
Arithmetic is supported.
>>> v + u
Vec(8, 8, -16)
>>> v - u
Vec(0, -2, 2)
abs
gives the hexagonal distance to the vector, i.e. the radius of the
hexagon on which it sits.
>>> abs(u)
9
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
hexagonal-0.0.3.tar.gz
(16.1 kB
view hashes)
Built Distribution
hexagonal-0.0.3-py3-none-any.whl
(15.4 kB
view hashes)
Close
Hashes for hexagonal-0.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0ddaafe2dfdf401f824ac0fc83b8c50bb0aef844542b1fac173bee37948f7ccf |
|
MD5 | 23fb29410464eb35b1851a188f5e5814 |
|
BLAKE2b-256 | 1c50bcf3c35a8c6d1de1aba7d42205c41a7ece1cd7d613db7da8608d5be266b7 |