Name | xtiler JSON |
Version |
0.1.0
JSON |
| download |
home_page | None |
Summary | Coordinate system for tiling with hexagons. |
upload_time | 2024-08-02 18:46:07 |
maintainer | None |
docs_url | None |
author | Tom Bricaud |
requires_python | >=3.8 |
license | None |
keywords |
coordinate
grid
hexagon
tiling
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# Hexa-tiling
Coordinate system for tiling with hexagons.
## What does the grid look like?
![Explaining illustration](images/illustration.jpg)
## How does it work?
### Rings and angles
The grid can be viewed as accumulation of concentric **rings**.
On the image, the **origin** is labelled 0,
surrounded by the **ring #1** composed of tiles 1-6,
surrounded by the **ring #2** composed of tiles 7-18.
### Numbering
Tiles are numbered from 0, in increasing order, starting at the
**origin** (center of the grid), spiraling around the **origin**,
with the first tile of each **ring** at 0°.
### Coordinates
Polar coordinates can be used to find a tile.
Each tile has a **radius** and an **angle**.
- The **radius** is the distance to the **origin**,
corresponding to the rank of the **ring** the tile belongs to.
- The **angle**, in degrees, is measured between the direction
"noon" (or "up", "north", etc) and the position of the tile.
## The maths behind it
### Ring length (Perimeter)
Let the ring length be $P$ and its rank $n$.
$$P(0) = 1$$
$$P(1) = 6$$
$$\forall n > 1, \quad P(n) = 2P(n-1)$$
$$\forall n > 0, \quad P(n) = 6 * 2^{n-1}$$
### Grid size (Area)
Let the number of tiles for a grid with $n$ rings be $A$.
$$A(n) = \sum^{n}_{i = 0}{P(i)}$$
$$= 1 + \sum^{n}_{i = 1}{6 * 2^{i-1}}$$
$$= 1 + 6 * \sum^{n-1}_{i = 0}{2^{i}}$$
$$= 1 + 6 * (2^n - 1)$$
$$= 6 * 2^n - 5$$
### Number from coordinates
Let the number of a tile be $X$, its radius $n$ and its angle $\alpha$.
$$X(0, \alpha) = 0$$
$$\forall n > 0, \quad X(n, \alpha) = A(n - 1) + \frac{\alpha}{360}P(n)$$
$$= 6 * 2^{n-1} - 5 + \frac{\alpha}{360}*6 * 2^{n-1}$$
$$= 6 * 2^{n-1}(1 + \frac{\alpha}{360}) -5$$
### Radius
To find the radius $n$ given the number $X$:
$$X = 0 \Leftrightarrow n = 0$$
$$0 \le \alpha < 360$$
$$\implies \forall n > 0, \quad X(n, 0) \quad \le \quad X(n,\alpha) \quad < \quad X(n, 360)$$
$$\implies \forall n > 0, \quad A(n - 1) + \frac{0}{360}P(n) \quad \le \quad X \quad < \quad A(n - 1) + \frac{360}{360}P(n)$$
$$\implies \forall n > 0, \quad A(n - 1) \quad \le \quad X \quad < \quad A(n - 1) + P(n) = A(n)$$
$$\implies \forall n > 0, \quad 6 * 2^{n-1} - 5 \quad \le \quad X \quad < \quad 6 * 2^n - 5$$
$$\implies \forall n > 0, \quad 2^{n-1} \quad \le \quad \frac{X + 5}{6} \quad < \quad 2^n$$
$$\implies \forall n > 0, \quad n-1 \quad \le \quad \log _2(\frac{X + 5}{6}) \quad < \quad n$$
$$\implies \forall n > 0, \quad n = \lfloor \log _2(\frac{X + 5}{6}) \rfloor + 1$$
### Angle
Tile 0 has no angle.
$$\forall n > 0, \quad X(n, \alpha) = 6 * 2^{n-1}(1 + \frac{\alpha}{360}) -5$$
$$X + 5 = 6 * 2^{n-1}(1 + \frac{\alpha}{360})$$
$$\frac{X + 5}{6 * 2^{n-1}} = 1 + \frac{\alpha}{360}$$
$$360(\frac{X + 5}{6 * 2^{n-1}} - 1) = \alpha$$
$$360(\frac{X + 5}{6 * 2^{\lfloor \log _2(\frac{X + 5}{6}) \rfloor + 1-1}} - 1) = \alpha$$
$$360(\frac{X + 5}{6 * 2^{\lfloor \log _2(\frac{X + 5}{6}) \rfloor }} - 1) = \alpha$$
Raw data
{
"_id": null,
"home_page": null,
"name": "xtiler",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "coordinate, grid, hexagon, tiling",
"author": "Tom Bricaud",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/8d/47/2b1b41f4e724eea0582d8782a9eebaa37ab90ca240764bd801859f98f26c/xtiler-0.1.0.tar.gz",
"platform": null,
"description": "# Hexa-tiling\nCoordinate system for tiling with hexagons.\n\n## What does the grid look like?\n\n![Explaining illustration](images/illustration.jpg)\n\n## How does it work?\n\n### Rings and angles\nThe grid can be viewed as accumulation of concentric **rings**.\nOn the image, the **origin** is labelled 0,\nsurrounded by the **ring #1** composed of tiles 1-6,\nsurrounded by the **ring #2** composed of tiles 7-18.\n\n### Numbering\nTiles are numbered from 0, in increasing order, starting at the\n**origin** (center of the grid), spiraling around the **origin**,\nwith the first tile of each **ring** at 0\u00b0.\n\n### Coordinates\nPolar coordinates can be used to find a tile.\nEach tile has a **radius** and an **angle**.\n\n- The **radius** is the distance to the **origin**,\ncorresponding to the rank of the **ring** the tile belongs to.\n- The **angle**, in degrees, is measured between the direction\n\"noon\" (or \"up\", \"north\", etc) and the position of the tile.\n\n## The maths behind it\n\n### Ring length (Perimeter)\nLet the ring length be $P$ and its rank $n$.\n\n$$P(0) = 1$$\n\n$$P(1) = 6$$\n\n$$\\forall n > 1, \\quad P(n) = 2P(n-1)$$\n\n$$\\forall n > 0, \\quad P(n) = 6 * 2^{n-1}$$\n\n### Grid size (Area)\nLet the number of tiles for a grid with $n$ rings be $A$.\n\n$$A(n) = \\sum^{n}_{i = 0}{P(i)}$$\n\n$$= 1 + \\sum^{n}_{i = 1}{6 * 2^{i-1}}$$\n\n$$= 1 + 6 * \\sum^{n-1}_{i = 0}{2^{i}}$$\n\n$$= 1 + 6 * (2^n - 1)$$\n\n$$= 6 * 2^n - 5$$\n\n### Number from coordinates\nLet the number of a tile be $X$, its radius $n$ and its angle $\\alpha$.\n\n$$X(0, \\alpha) = 0$$\n\n$$\\forall n > 0, \\quad X(n, \\alpha) = A(n - 1) + \\frac{\\alpha}{360}P(n)$$\n\n$$= 6 * 2^{n-1} - 5 + \\frac{\\alpha}{360}*6 * 2^{n-1}$$\n\n$$= 6 * 2^{n-1}(1 + \\frac{\\alpha}{360}) -5$$\n\n### Radius\nTo find the radius $n$ given the number $X$:\n\n$$X = 0 \\Leftrightarrow n = 0$$\n\n$$0 \\le \\alpha < 360$$\n\n$$\\implies \\forall n > 0, \\quad X(n, 0) \\quad \\le \\quad X(n,\\alpha) \\quad < \\quad X(n, 360)$$\n\n$$\\implies \\forall n > 0, \\quad A(n - 1) + \\frac{0}{360}P(n) \\quad \\le \\quad X \\quad < \\quad A(n - 1) + \\frac{360}{360}P(n)$$\n\n$$\\implies \\forall n > 0, \\quad A(n - 1) \\quad \\le \\quad X \\quad < \\quad A(n - 1) + P(n) = A(n)$$\n\n$$\\implies \\forall n > 0, \\quad 6 * 2^{n-1} - 5 \\quad \\le \\quad X \\quad < \\quad 6 * 2^n - 5$$\n\n$$\\implies \\forall n > 0, \\quad 2^{n-1} \\quad \\le \\quad \\frac{X + 5}{6} \\quad < \\quad 2^n$$\n\n$$\\implies \\forall n > 0, \\quad n-1 \\quad \\le \\quad \\log _2(\\frac{X + 5}{6}) \\quad < \\quad n$$\n\n$$\\implies \\forall n > 0, \\quad n = \\lfloor \\log _2(\\frac{X + 5}{6}) \\rfloor + 1$$\n\n### Angle\nTile 0 has no angle.\n\n$$\\forall n > 0, \\quad X(n, \\alpha) = 6 * 2^{n-1}(1 + \\frac{\\alpha}{360}) -5$$\n\n$$X + 5 = 6 * 2^{n-1}(1 + \\frac{\\alpha}{360})$$\n\n$$\\frac{X + 5}{6 * 2^{n-1}} = 1 + \\frac{\\alpha}{360}$$\n\n$$360(\\frac{X + 5}{6 * 2^{n-1}} - 1) = \\alpha$$\n\n$$360(\\frac{X + 5}{6 * 2^{\\lfloor \\log _2(\\frac{X + 5}{6}) \\rfloor + 1-1}} - 1) = \\alpha$$\n\n$$360(\\frac{X + 5}{6 * 2^{\\lfloor \\log _2(\\frac{X + 5}{6}) \\rfloor }} - 1) = \\alpha$$\n",
"bugtrack_url": null,
"license": null,
"summary": "Coordinate system for tiling with hexagons.",
"version": "0.1.0",
"project_urls": {
"Documentation": "https://github.com/LordPatate/hexa-tiling#readme",
"Issues": "https://github.com/LordPatate/hexa-tiling/issues",
"Source": "https://github.com/LordPatate/hexa-tiling"
},
"split_keywords": [
"coordinate",
" grid",
" hexagon",
" tiling"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "22b30b3d397cef4a36c709d4c6a628b6ec276976a5df62342f28346a33e95885",
"md5": "75f6e83120cc1655d2bdc0b3036df2a8",
"sha256": "843e94f2ef06a41026e6f161e451b1a57a9ad3fa2d371d331cc662a113178bcc"
},
"downloads": -1,
"filename": "xtiler-0.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "75f6e83120cc1655d2bdc0b3036df2a8",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 3685,
"upload_time": "2024-08-02T18:46:05",
"upload_time_iso_8601": "2024-08-02T18:46:05.429536Z",
"url": "https://files.pythonhosted.org/packages/22/b3/0b3d397cef4a36c709d4c6a628b6ec276976a5df62342f28346a33e95885/xtiler-0.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "8d472b1b41f4e724eea0582d8782a9eebaa37ab90ca240764bd801859f98f26c",
"md5": "80f7ed9237b1cc5b5d6de4db74ca1de3",
"sha256": "74d883180f6cd830b4ae82238cbc0585f92d473037a8f9e783ac37cc783c68e9"
},
"downloads": -1,
"filename": "xtiler-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "80f7ed9237b1cc5b5d6de4db74ca1de3",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 6614,
"upload_time": "2024-08-02T18:46:07",
"upload_time_iso_8601": "2024-08-02T18:46:07.431655Z",
"url": "https://files.pythonhosted.org/packages/8d/47/2b1b41f4e724eea0582d8782a9eebaa37ab90ca240764bd801859f98f26c/xtiler-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-08-02 18:46:07",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "LordPatate",
"github_project": "hexa-tiling#readme",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "xtiler"
}