close-paving 0.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,105 @@
1
+ Metadata-Version: 2.4
2
+ Name: close-paving
3
+ Version: 0.1
4
+ Summary: toolkit for hexagonal grid
5
+ Home-page: https://gitee.com/hoops/close-paving
6
+ Author: A.Star
7
+ Author-email: astar@snowland.ltd
8
+ Maintainer: A.Star
9
+ Maintainer-email: astar@snowland.ltd
10
+ License: Apache v2.0
11
+ Platform: all
12
+ Classifier: Operating System :: OS Independent
13
+ Classifier: Intended Audience :: Science/Research
14
+ Classifier: Programming Language :: Python
15
+ Classifier: Programming Language :: Python :: Implementation
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.7
18
+ Classifier: Programming Language :: Python :: 3.8
19
+ Classifier: Programming Language :: Python :: 3.9
20
+ Classifier: Programming Language :: Python :: 3.10
21
+ Classifier: Programming Language :: Python :: 3.11
22
+ Classifier: Programming Language :: Python :: 3.12
23
+ Classifier: Programming Language :: Python :: 3.13
24
+ Classifier: Topic :: Software Development :: Libraries
25
+ Description-Content-Type: text/markdown
26
+ License-File: LICENSE
27
+ Requires-Dist: astartool>=0.1
28
+ Requires-Dist: numpy
29
+ Requires-Dist: matplotlib
30
+ Dynamic: author
31
+ Dynamic: author-email
32
+ Dynamic: classifier
33
+ Dynamic: description
34
+ Dynamic: description-content-type
35
+ Dynamic: home-page
36
+ Dynamic: license
37
+ Dynamic: license-file
38
+ Dynamic: maintainer
39
+ Dynamic: maintainer-email
40
+ Dynamic: platform
41
+ Dynamic: requires-dist
42
+ Dynamic: summary
43
+
44
+ # honeycomb
45
+
46
+ #### Description
47
+
48
+ Hexagonal Grid.
49
+
50
+ #### Software Architecture
51
+ Software architecture description
52
+
53
+ - core
54
+ - kernel
55
+ - plot_helper
56
+
57
+
58
+ #### Installation
59
+
60
+ 1. Pypi
61
+ ```commandline
62
+ python install close-paving
63
+ ```
64
+
65
+ 2. Source code
66
+
67
+ - clone repo
68
+ ```commandline
69
+ git clone https://gitcode.net/astar/a.star/close-paving.git
70
+ ```
71
+
72
+ or
73
+
74
+ ```commandline
75
+ git clone https://gitee.com/hoops/close-paving.git
76
+ ```
77
+
78
+ - cd close_paving
79
+ ```commandline
80
+ cd close_paving
81
+ ```
82
+ - download requirements.txt
83
+ ```commandline
84
+ pip install -r requirements.txt
85
+ ```
86
+ - run commandline
87
+ ```commandline
88
+ python setup.py install
89
+ ```
90
+
91
+
92
+
93
+ #### how to use
94
+
95
+ ![direction type](./docs/images/direction.png)
96
+
97
+
98
+
99
+ #### contribute
100
+
101
+ 1. Fork repo
102
+ 2. create feature `Feat_xxx`
103
+ 3. commit
104
+ 4. create `Pull Request`
105
+
@@ -0,0 +1,79 @@
1
+ # close-paving
2
+
3
+ [![version](https://img.shields.io/pypi/v/close-paving.svg)](https://pypi.python.org/pypi/close-paving)
4
+ [![gitee](https://gitee.com/hoops/close-paving/badge/star.svg)](https://gitee.com/snowlandltd/close-paving/stargazers)
5
+ [![download](https://img.shields.io/pypi/dm/close-paving.svg)](https://pypi.org/project/close-paving)
6
+ [![wheel](https://img.shields.io/pypi/wheel/close-paving.svg)](https://pypi.python.org/pypi/close-paving)
7
+ ![licence](https://img.shields.io/pypi/l/close-paving.svg)
8
+ ![status](https://img.shields.io/pypi/status/close-paving.svg)
9
+
10
+
11
+ #### 介绍
12
+
13
+ 一个简单实用的六角形网格实现
14
+
15
+ #### 软件架构
16
+ 软件架构说明
17
+
18
+ - core
19
+ - error
20
+ - kernel
21
+ - plot_helper
22
+ - test
23
+
24
+
25
+ #### 安装教程
26
+
27
+ 1. pypi安装
28
+ ```commandline
29
+ python install close-paving
30
+ ```
31
+
32
+ 2. 源码安装
33
+
34
+ - 克隆仓库
35
+ ```commandline
36
+ git clone https://gitcode.net/astar/a.star/close-paving.git
37
+ ```
38
+
39
+ 或者
40
+
41
+ ```commandline
42
+ git clone https://gitee.com/hoops/close-paving.git
43
+ ```
44
+
45
+
46
+
47
+ - 跳转目录
48
+ ```commandline
49
+ cd close_paving
50
+ ```
51
+ - 下载依赖
52
+ ```commandline
53
+ pip install -r requirements.txt
54
+ ```
55
+
56
+
57
+
58
+
59
+
60
+ - 运行安装命令
61
+ ```commandline
62
+ python setup.py install
63
+ ```
64
+
65
+
66
+
67
+ #### 使用说明
68
+
69
+
70
+ ![direction type](./docs/images/direction.png)
71
+
72
+
73
+ #### 参与贡献
74
+
75
+ 1. Fork 本仓库
76
+ 2. 新建 Feat_xxx 分支
77
+ 3. 提交代码
78
+ 4. 新建 Pull Request
79
+
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env python
2
+ # -*- coding: utf-8 -*-
3
+ # @Author: A.Star
4
+ # @contact: astar@snowland.ltd
5
+ # @site: www.astar.ltd
6
+ # @file: __init__.py.py
7
+ # @time: 2021/7/1115:16
8
+ # @Software: PyCharm
9
+
10
+
11
+ __author__ = 'A.Star'
12
+
13
+ from astartool.setuptool import get_version
14
+
15
+ version = (0, 1, 0, 'final', 0)
16
+
17
+ __version__ = get_version(version)
File without changes
@@ -0,0 +1,7 @@
1
+
2
+ from abc import ABCMeta
3
+
4
+
5
+ class Cell(metaclass=ABCMeta):
6
+ def __init__(self, *args, **kwargs):
7
+ pass
@@ -0,0 +1,17 @@
1
+
2
+
3
+ class Direction:
4
+ vertical = 0
5
+ horizontal = 1
6
+ left_left = 0
7
+ left_right = 2
8
+ right_left = 4
9
+ right_right = 6
10
+
11
+ def get_direction_tuple(direction: int) -> tuple[int, int]:
12
+ """
13
+ 获得Direction元祖
14
+ :param direction:
15
+ :return:
16
+ """
17
+ return direction & 1, direction & 6
@@ -0,0 +1,54 @@
1
+ from typing import List, Tuple, Union
2
+
3
+ import numpy as np
4
+
5
+ from close_paving.core.cell import Cell
6
+ from close_paving.core.direction import Direction
7
+
8
+
9
+ class Hexagon(Cell):
10
+ def __init__(self, center: Union[List[float], np.ndarray, Tuple[float]] = (0, 0),
11
+ radius: float = 0.0,
12
+ direction=Direction.horizontal, **kwargs):
13
+ assert radius >= 0
14
+ super().__init__()
15
+ self.center = np.array(center)
16
+ self.radius = radius
17
+ self.direction = direction
18
+ self.__dict__.update(kwargs)
19
+
20
+ @property
21
+ def points(self):
22
+ if self.direction == Direction.vertical:
23
+ half_r = self.radius / 2
24
+ root3_half_r = np.sqrt(3) * half_r
25
+ x1, x2, x3, x4, x5, x6 = -root3_half_r, 0, root3_half_r, root3_half_r, 0, -root3_half_r
26
+ y1, y2, y3, y4, y5, y6 = -half_r, -self.radius, -half_r, half_r, self.radius, half_r
27
+
28
+ delta = np.vstack([
29
+ [x1, y1], [x2, y2], [x3, y3], [x4, y4], [x5, y5], [x6, y6], [x1, y1]
30
+ ])
31
+ center = np.vstack([self.center] * 7)
32
+ return center + delta
33
+ else:
34
+ half_r = self.radius / 2
35
+ root3_half_r = np.sqrt(3) * half_r
36
+ x1, x2, x3, x4, x5, x6 = -half_r, half_r, self.radius, half_r, -half_r, -self.radius
37
+ y1, y2, y3, y4, y5, y6 = -root3_half_r, -root3_half_r, 0, root3_half_r, root3_half_r, 0
38
+ delta = np.vstack([
39
+ [x1, y1], [x2, y2], [x3, y3], [x4, y4], [x5, y5], [x6, y6], [x1, y1]
40
+ ])
41
+ center = np.vstack([self.center] * 7)
42
+ return center + delta
43
+
44
+
45
+ class HorizontalHexagon(Hexagon):
46
+ def __init__(self, center: Union[List[float], np.ndarray, Tuple[float]] = (0, 0),
47
+ radius: float = 0.0):
48
+ super().__init__(center, radius, direction=Direction.horizontal)
49
+
50
+
51
+ class VerticalHexagon(Hexagon):
52
+ def __init__(self, center: Union[List[float], np.ndarray, Tuple[float]] = (0, 0),
53
+ radius: float = 0.0):
54
+ super().__init__(center, radius, direction=Direction.vertical)
@@ -0,0 +1,414 @@
1
+ import itertools
2
+ from typing import List, Tuple, Union, Dict, Iterable
3
+
4
+ import numpy as np
5
+ from astartool.error import ParameterTypeError, ParameterValueError
6
+
7
+ from close_paving.core.cell import Cell
8
+ from close_paving.core.direction import Direction, get_direction_tuple
9
+ from close_paving.error import TypeNotAllowedError
10
+
11
+ npl = np.linalg
12
+
13
+ SQRT3 = np.sqrt(3)
14
+
15
+
16
+ class HexagonGrid:
17
+ def __init__(self, seed: Union[List[float], np.ndarray, Tuple[float]] = (0, 0),
18
+ radius: float = 0.0,
19
+ shape: Tuple[int, int] = (0, 0),
20
+ direction=Direction.vertical | Direction.left_right,
21
+ value_list: Dict[str, Union[np.ndarray, list]] = None):
22
+ self.seed = np.array(seed)
23
+ self.radius = radius
24
+ self.shape = shape
25
+ self.direction = direction
26
+ if value_list is None:
27
+ self.value_dict = None
28
+ elif isinstance(value_list, dict):
29
+ self.value_dict = value_list
30
+ elif isinstance(value_list, np.ndarray):
31
+ self.value_dict = {"value": value_list}
32
+ else:
33
+ raise ParameterTypeError("Type of `value_list` must be list or np.ndarray.")
34
+
35
+ def to_cells(self, class_type=Cell, *args, **kwargs):
36
+ """
37
+ 获取元胞矩阵
38
+ :param class_type: 元胞类型
39
+ :param args:
40
+ :param kwargs:
41
+ :return:
42
+ """
43
+ half_radius = self.radius / 2
44
+ one_and_a_half_radius = half_radius + self.radius
45
+ root3_radius = SQRT3 * self.radius
46
+ root3_half_radius = root3_radius / 2
47
+ x = np.empty(shape=self.shape)
48
+ y = np.empty(shape=self.shape)
49
+ direction_tuple = get_direction_tuple(self.direction)
50
+ direction = direction_tuple[0]
51
+ if direction == Direction.horizontal:
52
+ if direction_tuple[1] == Direction.right_right:
53
+ xi = self.seed[0] + one_and_a_half_radius * np.arange(self.shape[0])
54
+ x = np.repeat(np.expand_dims(xi, 1), self.shape[1], axis=1)
55
+ yi = self.seed[1] + root3_radius * np.arange(self.shape[1])
56
+ for col in range(0, self.shape[0]):
57
+ y[col, :] = yi - root3_half_radius * col
58
+ elif direction_tuple[1] == Direction.right_left:
59
+ xi = self.seed[0] + one_and_a_half_radius * np.arange(self.shape[0])
60
+ x = np.repeat(np.expand_dims(xi, 1), self.shape[1], axis=1)
61
+ yi = self.seed[1] + root3_radius * np.arange(self.shape[1])
62
+ yii = yi - root3_half_radius
63
+ for col in range(0, self.shape[0], 2):
64
+ y[col, :] = yi
65
+ for col in range(1, self.shape[0], 2):
66
+ y[col, :] = yii
67
+ elif direction_tuple[1] == Direction.left_right:
68
+ xi = self.seed[0] + one_and_a_half_radius * np.arange(self.shape[0])
69
+ x = np.repeat(np.expand_dims(xi, 1), self.shape[1], axis=1)
70
+ yi = self.seed[1] + root3_radius * np.arange(self.shape[1])
71
+ yii = yi + root3_half_radius
72
+ for col in range(0, self.shape[0], 2):
73
+ y[col, :] = yi
74
+ for col in range(1, self.shape[0], 2):
75
+ y[col, :] = yii
76
+ elif direction_tuple[1] == Direction.left_left:
77
+ xi = self.seed[0] + one_and_a_half_radius * np.arange(self.shape[0])
78
+ x = np.repeat(np.expand_dims(xi, 1), self.shape[1], axis=1)
79
+ yi = self.seed[1] + root3_radius * np.arange(self.shape[1])
80
+ for col in range(0, self.shape[0]):
81
+ y[col, :] = yi + root3_half_radius * col
82
+ else:
83
+ raise ParameterValueError("Value of `direction` is unknown")
84
+ else:
85
+ if direction_tuple[1] == Direction.right_right:
86
+ xi = self.seed[0] + root3_radius * np.arange(self.shape[0])
87
+ for row in range(0, self.shape[1]):
88
+ x[:, row] = xi + root3_half_radius * row
89
+ yi = self.seed[1] + one_and_a_half_radius * np.arange(self.shape[1])
90
+ y = np.repeat(yi.reshape((1, -1)), self.shape[0], axis=0)
91
+ elif direction_tuple[1] == Direction.right_left:
92
+ xi = self.seed[0] + root3_radius * np.arange(self.shape[0])
93
+ xii = xi + root3_half_radius
94
+ for row in range(0, self.shape[1], 2):
95
+ x[:, row] = xi
96
+ for row in range(1, self.shape[1], 2):
97
+ x[:, row] = xii
98
+ yi = self.seed[1] + one_and_a_half_radius * np.arange(self.shape[1])
99
+ y = np.repeat(yi.reshape((1, -1)), self.shape[0], axis=0)
100
+ elif direction_tuple[1] == Direction.left_right:
101
+ xi = self.seed[0] + root3_radius * np.arange(self.shape[0])
102
+ xii = xi - root3_half_radius
103
+ for row in range(0, self.shape[1], 2):
104
+ x[:, row] = xi
105
+ for row in range(1, self.shape[1], 2):
106
+ x[:, row] = xii
107
+ yi = self.seed[1] + one_and_a_half_radius * np.arange(self.shape[1])
108
+ y = np.repeat(yi.reshape((1, -1)), self.shape[0], axis=0)
109
+ elif direction_tuple[1] == Direction.left_left:
110
+ xi = self.seed[0] + root3_radius * np.arange(self.shape[0])
111
+ for row in range(0, self.shape[1]):
112
+ x[:, row] = xi - root3_half_radius * row
113
+ yi = self.seed[1] + one_and_a_half_radius * np.arange(self.shape[1])
114
+ y = np.repeat(yi.reshape((1, -1)), self.shape[0], axis=0)
115
+ else:
116
+ raise ParameterValueError("Value of `direction` is unknown")
117
+ if self.value_dict is None:
118
+ return [
119
+ [class_type(center=(x[i, j], y[i, j]), radius=self.radius, direction=direction, *args, **kwargs) for j
120
+ in range(self.shape[1])] for i in range(self.shape[0])]
121
+ else:
122
+ return [[class_type(center=(x[i, j], y[i, j]), radius=self.radius, direction=direction, *args,
123
+ **{k: v[i][j] for k, v in self.value_dict.items()}) for j in
124
+ range(self.shape[1])] for i in range(self.shape[0])]
125
+
126
+ def filter_index(self, indexes: Iterable[Tuple[int, int]]):
127
+ """
128
+ 按元胞形状过滤异常的索引, 异常的坐标将返回None
129
+ :param indexes:
130
+ :return:
131
+ """
132
+ return [(index if (0 <= index[0] < self.shape[0]) and (0 <= index[1] < self.shape[1]) else None) for index in
133
+ indexes]
134
+
135
+ def get_distance(self, src_index, dst_index):
136
+ """
137
+ 返回两坐标之间的距离
138
+ :param src_index:
139
+ :param dst_index:
140
+ :return:
141
+ """
142
+ src_index = tuple(src_index)
143
+ dst_index = tuple(dst_index)
144
+ if not (0 <= src_index[0] < self.shape[0]):
145
+ raise ParameterValueError("src_index is out of bounds")
146
+
147
+ if not (0 <= src_index[1] < self.shape[1]):
148
+ raise ParameterValueError("src_index is out of bounds")
149
+
150
+ if not (0 <= dst_index[0] < self.shape[0]):
151
+ raise ParameterValueError("dst_index is out of bounds")
152
+
153
+ if not (0 <= dst_index[1] < self.shape[1]):
154
+ raise ParameterValueError("dst_index is out of bounds")
155
+
156
+ direction_tuple = get_direction_tuple(self.direction)
157
+ direction = direction_tuple[1]
158
+ if direction_tuple[0] == Direction.vertical:
159
+ if direction == Direction.left_left:
160
+ if dst_index[1] > src_index[1]:
161
+ height_delta = abs(dst_index[1] - src_index[1])
162
+ bound_low = src_index[0]
163
+ bound_high = min(src_index[0] + height_delta, self.shape[0] - 1)
164
+ else:
165
+ height_delta = abs(dst_index[1] - src_index[1])
166
+ bound_low = max(src_index[0] - height_delta, 0)
167
+ bound_high = src_index[0]
168
+
169
+ if dst_index[0] < bound_low:
170
+ return height_delta + bound_low - dst_index[0]
171
+ elif bound_low <= dst_index[0] <= bound_high:
172
+ return height_delta
173
+ else:
174
+ return height_delta + dst_index[0] - bound_high
175
+
176
+ elif direction == Direction.left_right:
177
+ src_col_is_odd = src_index[1] % 2
178
+ dst_col_is_odd = dst_index[1] % 2
179
+ if dst_index[1] > src_index[1]:
180
+ delta = (dst_index[1] - src_index[1]) // 2
181
+ else:
182
+ delta = - (dst_index[1] - src_index[1]) // 2
183
+ if src_col_is_odd and dst_col_is_odd:
184
+ height_delta = abs(dst_index[1] - src_index[1])
185
+ bound_low = src_index[0] - delta
186
+ bound_high = src_index[0] + delta
187
+ if bound_low <= dst_index[0] <= bound_high:
188
+ return height_delta
189
+ else:
190
+ return height_delta + min(abs(bound_low - dst_index[0]), abs(dst_index[0] - bound_high))
191
+ elif src_col_is_odd and not dst_col_is_odd:
192
+ height_delta = abs(dst_index[1] - src_index[1])
193
+ bound_low = src_index[0] - delta - 1
194
+ bound_high = src_index[0] + delta
195
+ if bound_low <= dst_index[0] <= bound_high:
196
+ return height_delta
197
+ else:
198
+ return height_delta + min(abs(bound_low - dst_index[0]), abs(dst_index[0] - bound_high))
199
+
200
+
201
+ elif not src_col_is_odd and dst_col_is_odd:
202
+ height_delta = abs(dst_index[1] - src_index[1])
203
+ if dst_index[1] < src_index[1]:
204
+ bound_low = max(0, src_index[0] - delta)
205
+ bound_high = min(src_index[0] + delta + 1, self.shape[0] - 1)
206
+ else:
207
+ bound_low = max(0, src_index[0] - delta)
208
+ bound_high = min(src_index[0] + delta + 1, self.shape[0] - 1)
209
+
210
+ if bound_low <= dst_index[0] <= bound_high:
211
+ return height_delta
212
+ else:
213
+ return height_delta + min(abs(bound_low - dst_index[0]), abs(dst_index[0] - bound_high))
214
+ else:
215
+ # not src_col_is_odd and not dst_col_is_odd
216
+ height_delta = abs(dst_index[1] - src_index[1])
217
+ bound_low = src_index[0] - delta
218
+ bound_high = src_index[0] + delta
219
+ if bound_low <= dst_index[0] <= bound_high:
220
+ return height_delta
221
+ else:
222
+ return height_delta + min(abs(bound_low - dst_index[0]), abs(dst_index[0] - bound_high))
223
+ elif direction == Direction.right_left:
224
+ src_col_is_odd = src_index[1] % 2
225
+ dst_col_is_odd = dst_index[1] % 2
226
+ if dst_index[1] > src_index[1]:
227
+ delta = (dst_index[1] - src_index[1]) // 2
228
+ else:
229
+ delta = - (dst_index[1] - src_index[1]) // 2
230
+ if src_col_is_odd and dst_col_is_odd:
231
+ height_delta = abs(dst_index[1] - src_index[1])
232
+ bound_low = src_index[0] - delta
233
+ bound_high = src_index[0] + delta
234
+ if bound_low <= dst_index[0] <= bound_high:
235
+ return height_delta
236
+ else:
237
+ return height_delta + min(abs(bound_low - dst_index[0]), abs(dst_index[0] - bound_high))
238
+ elif src_col_is_odd and not dst_col_is_odd:
239
+ height_delta = abs(dst_index[1] - src_index[1])
240
+ bound_low = src_index[0] - delta
241
+ bound_high = src_index[0] + delta + 1
242
+ if bound_low <= dst_index[0] <= bound_high:
243
+ return height_delta
244
+ else:
245
+ return height_delta + min(abs(bound_low - dst_index[0]), abs(dst_index[0] - bound_high))
246
+
247
+
248
+ elif not src_col_is_odd and dst_col_is_odd:
249
+ height_delta = abs(dst_index[1] - src_index[1])
250
+ bound_low = max(0, src_index[0] - delta - 1)
251
+ bound_high = min(src_index[0] + delta, self.shape[0] - 1)
252
+ if bound_low <= dst_index[0] <= bound_high:
253
+ return height_delta
254
+ else:
255
+ return height_delta + min(abs(bound_low - dst_index[0]), abs(dst_index[0] - bound_high))
256
+ else:
257
+ # not src_col_is_odd and not dst_col_is_odd
258
+ height_delta = abs(dst_index[1] - src_index[1])
259
+ bound_low = src_index[0] - delta
260
+ bound_high = src_index[0] + delta
261
+ if bound_low <= dst_index[0] <= bound_high:
262
+ return height_delta
263
+ else:
264
+ return height_delta + min(abs(bound_low - dst_index[0]), abs(dst_index[0] - bound_high))
265
+ elif direction == Direction.right_right:
266
+ if dst_index[1] > src_index[1]:
267
+ height_delta = abs(dst_index[1] - src_index[1])
268
+ bound_low = max(src_index[0] - height_delta, 0)
269
+ bound_high = src_index[0]
270
+ else:
271
+ height_delta = abs(dst_index[1] - src_index[1])
272
+ bound_low = src_index[0]
273
+ bound_high = min(src_index[0] + height_delta, self.shape[0])
274
+
275
+ if bound_low <= dst_index[0] <= bound_high:
276
+ return height_delta
277
+ else:
278
+ return height_delta + min(abs(bound_low - dst_index[0]), abs(dst_index[0] - bound_high))
279
+ else:
280
+ raise TypeNotAllowedError(
281
+ "`direction` must be in (Direction.left_left, Direction.left_right, Direction.right_left, Direction.right_right)")
282
+ else:
283
+ if direction == Direction.left_left:
284
+ delta = dst_index[0] - src_index[0]
285
+ if delta >= 0:
286
+ bound_low = max(0, src_index[1] - delta)
287
+ bound_high = src_index[1]
288
+ else:
289
+ delta = -delta
290
+ bound_low = src_index[1]
291
+ bound_high = min(self.shape[1] - 1, src_index[1] + delta)
292
+ if dst_index[1] < bound_low:
293
+ return delta + bound_low - dst_index[1]
294
+ elif bound_low <= dst_index[1] <= bound_high:
295
+ return delta
296
+ else:
297
+ return delta + dst_index[1] - bound_high
298
+
299
+ elif direction == Direction.left_right:
300
+ src_col_is_odd = src_index[0] % 2
301
+ dst_col_is_odd = dst_index[0] % 2
302
+ if dst_index[0] > src_index[0]:
303
+ delta = (dst_index[0] - src_index[0]) // 2
304
+ else:
305
+ delta = - (dst_index[0] - src_index[0]) // 2
306
+ if src_col_is_odd and dst_col_is_odd:
307
+ height_delta = abs(dst_index[0] - src_index[0])
308
+ bound_low = src_index[1] - delta
309
+ bound_high = src_index[1] + delta
310
+ if bound_low <= dst_index[1] <= bound_high:
311
+ return height_delta
312
+ else:
313
+ return height_delta + min(abs(bound_low - dst_index[1]), abs(dst_index[1] - bound_high))
314
+ elif src_col_is_odd and not dst_col_is_odd:
315
+ height_delta = abs(dst_index[0] - src_index[0])
316
+ bound_low = src_index[1] - delta
317
+ bound_high = src_index[1] + delta + 1
318
+ if bound_low <= dst_index[1] <= bound_high:
319
+ return height_delta
320
+ else:
321
+ return height_delta + min(abs(bound_low - dst_index[1]), abs(dst_index[1] - bound_high))
322
+
323
+
324
+ elif not src_col_is_odd and dst_col_is_odd:
325
+ height_delta = abs(dst_index[0] - src_index[0])
326
+ bound_low = max(0, src_index[1] - delta - 1)
327
+ bound_high = min(src_index[1] + delta, self.shape[1] - 1)
328
+
329
+ if bound_low <= dst_index[1] <= bound_high:
330
+ return height_delta
331
+ else:
332
+ return height_delta + min(abs(bound_low - dst_index[1]), abs(dst_index[1] - bound_high))
333
+ else:
334
+ # not src_col_is_odd and not dst_col_is_odd
335
+ height_delta = abs(dst_index[0] - src_index[0])
336
+ bound_low = src_index[1] - delta
337
+ bound_high = src_index[1] + delta
338
+ if bound_low <= dst_index[1] <= bound_high:
339
+ return height_delta
340
+ else:
341
+ return height_delta + min(abs(bound_low - dst_index[1]), abs(dst_index[1] - bound_high))
342
+ elif direction == Direction.right_left:
343
+ src_col_is_odd = src_index[0] % 2
344
+ dst_col_is_odd = dst_index[0] % 2
345
+ if dst_index[0] > src_index[0]:
346
+ delta = (dst_index[0] - src_index[0]) // 2
347
+ else:
348
+ delta = - (dst_index[0] - src_index[0]) // 2
349
+ if src_col_is_odd and dst_col_is_odd:
350
+ height_delta = abs(dst_index[0] - src_index[0])
351
+ bound_low = src_index[1] - delta
352
+ bound_high = src_index[1] + delta
353
+ if bound_low <= dst_index[1] <= bound_high:
354
+ return height_delta
355
+ else:
356
+ return height_delta + min(abs(bound_low - dst_index[1]), abs(dst_index[1] - bound_high))
357
+ elif src_col_is_odd and not dst_col_is_odd:
358
+ height_delta = abs(dst_index[0] - src_index[0])
359
+ bound_low = src_index[1] - delta - 1
360
+ bound_high = src_index[1] + delta
361
+ if bound_low <= dst_index[1] <= bound_high:
362
+ return height_delta
363
+ else:
364
+ return height_delta + min(abs(bound_low - dst_index[1]), abs(dst_index[1] - bound_high))
365
+
366
+ elif not src_col_is_odd and dst_col_is_odd:
367
+ height_delta = abs(dst_index[0] - src_index[0])
368
+ bound_low = max(0, src_index[1] - delta)
369
+ bound_high = min(src_index[1] + delta + 1, self.shape[1] - 1)
370
+ if bound_low <= dst_index[1] <= bound_high:
371
+ return height_delta
372
+ else:
373
+ return height_delta + min(abs(bound_low - dst_index[1]), abs(dst_index[1] - bound_high))
374
+ else:
375
+ # not src_col_is_odd and not dst_col_is_odd
376
+ height_delta = abs(dst_index[0] - src_index[0])
377
+ bound_low = src_index[1] - delta
378
+ bound_high = src_index[1] + delta
379
+ if bound_low <= dst_index[1] <= bound_high:
380
+ return height_delta
381
+ else:
382
+ return height_delta + min(abs(bound_low - dst_index[1]), abs(dst_index[1] - bound_high))
383
+ elif direction == Direction.right_right:
384
+
385
+ if dst_index[0] > src_index[0]:
386
+ height_delta = abs(dst_index[0] - src_index[0])
387
+ bound_low = src_index[1]
388
+ bound_high = min(src_index[1] + height_delta, self.shape[1])
389
+ else:
390
+ height_delta = abs(dst_index[0] - src_index[0])
391
+ bound_low = max(0, src_index[1] - height_delta)
392
+ bound_high = src_index[1]
393
+
394
+ if bound_low <= dst_index[1] <= bound_high:
395
+ return height_delta
396
+ else:
397
+ return height_delta + min(abs(bound_low - dst_index[1]), abs(dst_index[1] - bound_high))
398
+
399
+ else:
400
+ raise TypeNotAllowedError(
401
+ "`direction` must be in (Direction.left_left, Direction.left_right, Direction.right_left, Direction.right_right)")
402
+
403
+ def neighbours(self, c, distance=1):
404
+ """
405
+ 获取坐标c distance范围内的所有坐标
406
+ :param c:
407
+ :param distance:
408
+ :return:
409
+ """
410
+
411
+ bound_x = (max(0, c[0] - distance - 1), min(self.shape[0], c[0] + distance + 1))
412
+ bound_y = (max(0, c[1] - distance - 1), min(self.shape[1], c[1] + distance + 1))
413
+ return set(filter(lambda x: self.get_distance(x, c) <= distance,
414
+ itertools.product(range(*bound_x), range(*bound_y)))) - {c}
@@ -0,0 +1,7 @@
1
+
2
+
3
+ from astartool.error import ParameterValueError
4
+
5
+ class TypeNotAllowedError(ParameterValueError):
6
+ def __init__(self, *args, **kwargs): # real signature unknown
7
+ super().__init__(*args)
@@ -0,0 +1,21 @@
1
+ import numpy as np
2
+ from close_paving.kernel.gen_kernel import gen_kernel
3
+
4
+ npa = np.array
5
+
6
+ vertical_left_left_kernel = npa([[1, 1, 0], [1, 1, 1], [0, 1, 1]])
7
+ vertical_right_right_kernel = npa([[0, 1, 1], [1, 1, 1], [1, 1, 0]])
8
+
9
+ vertical_left_right_kernel_odd = vertical_left_left_kernel
10
+ vertical_left_right_kernel_even = vertical_right_right_kernel
11
+ vertical_right_left_kernel_odd = vertical_right_right_kernel
12
+ vertical_right_left_kernel_even = vertical_left_left_kernel
13
+
14
+
15
+ horizontal_left_left_kernel = npa([[0, 1, 1], [1, 1, 1], [1, 1, 0]])
16
+ horizontal_right_right_kernel = npa([[1, 1, 0], [1, 1, 1], [0, 1, 1]])
17
+
18
+ horizontal_left_right_kernel_odd = horizontal_left_left_kernel
19
+ horizontal_left_right_kernel_even = horizontal_right_right_kernel
20
+ horizontal_right_left_kernel_odd = horizontal_right_right_kernel
21
+ horizontal_right_left_kernel_even = horizontal_left_left_kernel
@@ -0,0 +1,54 @@
1
+ from close_paving.core.direction import Direction
2
+ from close_paving.core.direction import get_direction_tuple
3
+
4
+ import numpy as np
5
+ from astartool.error import ParameterValueError
6
+ from close_paving.error import TypeNotAllowedError
7
+
8
+ __all__ = [
9
+ 'gen_kernel'
10
+ ]
11
+
12
+
13
+ def gen_kernel(size=3, kernel_type=Direction.left_left | Direction.vertical):
14
+ """
15
+
16
+ :param kernel_type:
17
+ :return:
18
+ """
19
+ if size <= 0 or size & 2 == 0:
20
+ raise ParameterValueError("Parameter `size` must be a positive odd number.")
21
+ direction_tuple = get_direction_tuple(kernel_type)
22
+ direction = direction_tuple[1]
23
+ kernel = np.eye(size)
24
+ if direction_tuple[0] == Direction.vertical:
25
+ if direction == Direction.left_left:
26
+ for i in range(size // 2):
27
+ kernel += np.diag(np.ones(size - i - 1), k=i + 1)
28
+ kernel += np.diag(np.ones(size - i - 1), k=-i - 1)
29
+ elif direction == Direction.left_right:
30
+ raise TypeNotAllowedError("kernel_type must be in (Direction.left_left, Direction.right_right).")
31
+ elif direction == Direction.right_left:
32
+ raise TypeNotAllowedError("kernel_type must be in (Direction.left_left, Direction.right_right).")
33
+ elif direction == Direction.right_right:
34
+ for i in range(size // 2):
35
+ kernel += np.diag(np.ones(size - i - 1), k=i + 1)
36
+ kernel += np.diag(np.ones(size - i - 1), k=-i - 1)
37
+ kernel = kernel[::-1]
38
+
39
+ else:
40
+ kernel = np.eye(size)
41
+ if direction == Direction.left_left:
42
+ for i in range(size // 2):
43
+ kernel += np.diag(np.ones(size - i - 1), k=i + 1)
44
+ kernel += np.diag(np.ones(size - i - 1), k=-i - 1)
45
+ kernel = kernel[::-1]
46
+ elif direction == Direction.left_right:
47
+ raise TypeNotAllowedError("kernel_type must be in (Direction.left_left, Direction.right_right).")
48
+ elif direction == Direction.right_left:
49
+ raise TypeNotAllowedError("kernel_type must be in (Direction.left_left, Direction.right_right).")
50
+ elif direction == Direction.right_right:
51
+ for i in range(size // 2):
52
+ kernel += np.diag(np.ones(size - i - 1), k=i + 1)
53
+ kernel += np.diag(np.ones(size - i - 1), k=-i - 1)
54
+ return kernel
@@ -0,0 +1,2 @@
1
+ # -*- coding: utf-8 -*-
2
+
@@ -0,0 +1,37 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+
4
+ import numpy as np
5
+
6
+ from close_paving.core.cell import Cell
7
+ from close_paving.core.hexagon import Hexagon
8
+ from close_paving.core.hexagonal_grid import HexagonGrid
9
+ from matplotlib import pylab as plt
10
+
11
+
12
+ def plot_hexagon(hexagon: Hexagon, *args, handler=plt, **kwargs):
13
+ """
14
+ 绘制六角形
15
+ :param hexagon:
16
+ :param args:
17
+ :param handler:
18
+ :param kwargs:
19
+ :return:
20
+ """
21
+ points = hexagon.points
22
+ handler.plot(points[:, 0], points[:, 1], *args, **kwargs)
23
+
24
+
25
+ def plot_hexagonal_grid(hexagon_grid: HexagonGrid, *args, handler=plt, **kwargs):
26
+ """
27
+ 绘制六角形网络
28
+ :param hexagon_grid:
29
+ :param args:
30
+ :param handler:
31
+ :param kwargs:
32
+ :return:
33
+ """
34
+ cell_list = hexagon_grid.to_cells(Hexagon)
35
+ for row_cells in cell_list:
36
+ for hexagon in row_cells:
37
+ plot_hexagon(hexagon, handler=handler, *args, **kwargs)
@@ -0,0 +1,105 @@
1
+ Metadata-Version: 2.4
2
+ Name: close-paving
3
+ Version: 0.1
4
+ Summary: toolkit for hexagonal grid
5
+ Home-page: https://gitee.com/hoops/close-paving
6
+ Author: A.Star
7
+ Author-email: astar@snowland.ltd
8
+ Maintainer: A.Star
9
+ Maintainer-email: astar@snowland.ltd
10
+ License: Apache v2.0
11
+ Platform: all
12
+ Classifier: Operating System :: OS Independent
13
+ Classifier: Intended Audience :: Science/Research
14
+ Classifier: Programming Language :: Python
15
+ Classifier: Programming Language :: Python :: Implementation
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.7
18
+ Classifier: Programming Language :: Python :: 3.8
19
+ Classifier: Programming Language :: Python :: 3.9
20
+ Classifier: Programming Language :: Python :: 3.10
21
+ Classifier: Programming Language :: Python :: 3.11
22
+ Classifier: Programming Language :: Python :: 3.12
23
+ Classifier: Programming Language :: Python :: 3.13
24
+ Classifier: Topic :: Software Development :: Libraries
25
+ Description-Content-Type: text/markdown
26
+ License-File: LICENSE
27
+ Requires-Dist: astartool>=0.1
28
+ Requires-Dist: numpy
29
+ Requires-Dist: matplotlib
30
+ Dynamic: author
31
+ Dynamic: author-email
32
+ Dynamic: classifier
33
+ Dynamic: description
34
+ Dynamic: description-content-type
35
+ Dynamic: home-page
36
+ Dynamic: license
37
+ Dynamic: license-file
38
+ Dynamic: maintainer
39
+ Dynamic: maintainer-email
40
+ Dynamic: platform
41
+ Dynamic: requires-dist
42
+ Dynamic: summary
43
+
44
+ # honeycomb
45
+
46
+ #### Description
47
+
48
+ Hexagonal Grid.
49
+
50
+ #### Software Architecture
51
+ Software architecture description
52
+
53
+ - core
54
+ - kernel
55
+ - plot_helper
56
+
57
+
58
+ #### Installation
59
+
60
+ 1. Pypi
61
+ ```commandline
62
+ python install close-paving
63
+ ```
64
+
65
+ 2. Source code
66
+
67
+ - clone repo
68
+ ```commandline
69
+ git clone https://gitcode.net/astar/a.star/close-paving.git
70
+ ```
71
+
72
+ or
73
+
74
+ ```commandline
75
+ git clone https://gitee.com/hoops/close-paving.git
76
+ ```
77
+
78
+ - cd close_paving
79
+ ```commandline
80
+ cd close_paving
81
+ ```
82
+ - download requirements.txt
83
+ ```commandline
84
+ pip install -r requirements.txt
85
+ ```
86
+ - run commandline
87
+ ```commandline
88
+ python setup.py install
89
+ ```
90
+
91
+
92
+
93
+ #### how to use
94
+
95
+ ![direction type](./docs/images/direction.png)
96
+
97
+
98
+
99
+ #### contribute
100
+
101
+ 1. Fork repo
102
+ 2. create feature `Feat_xxx`
103
+ 3. commit
104
+ 4. create `Pull Request`
105
+
@@ -0,0 +1,19 @@
1
+ LICENSE
2
+ README.md
3
+ setup.py
4
+ close_paving/__init__.py
5
+ close_paving.egg-info/PKG-INFO
6
+ close_paving.egg-info/SOURCES.txt
7
+ close_paving.egg-info/dependency_links.txt
8
+ close_paving.egg-info/requires.txt
9
+ close_paving.egg-info/top_level.txt
10
+ close_paving/core/__init__.py
11
+ close_paving/core/cell.py
12
+ close_paving/core/direction.py
13
+ close_paving/core/hexagon.py
14
+ close_paving/core/hexagonal_grid.py
15
+ close_paving/error/__init__.py
16
+ close_paving/kernel/__init__.py
17
+ close_paving/kernel/gen_kernel.py
18
+ close_paving/plot_helper/__init__.py
19
+ close_paving/plot_helper/plot_helper.py
@@ -0,0 +1,3 @@
1
+ astartool>=0.1
2
+ numpy
3
+ matplotlib
@@ -0,0 +1 @@
1
+ close_paving
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,50 @@
1
+ #!/usr/bin/env python
2
+ # -*- coding: utf-8 -*-
3
+ # @Author : A.Star
4
+ # @contact: astar@snowland.ltd
5
+ # @site: www.snowland.ltd
6
+ # @file: setup.py
7
+ # @time: 2025/10/8 23:31
8
+ # @Software: PyCharm
9
+
10
+
11
+ import os
12
+ from setuptools import find_packages
13
+ from close_paving import version
14
+ from astartool.setuptool import load_install_requires, get_version, setup, read_file
15
+
16
+ osp = os.path
17
+
18
+ setup(
19
+ name='close-paving',
20
+ version=get_version(version),
21
+ description=(
22
+ 'toolkit for hexagonal grid'
23
+ ),
24
+ long_description=read_file('README.en.md', encoding='utf-8'),
25
+ long_description_content_type='text/markdown',
26
+ author='A.Star',
27
+ author_email='astar@snowland.ltd',
28
+ maintainer='A.Star',
29
+ maintainer_email='astar@snowland.ltd',
30
+ license='Apache v2.0',
31
+ packages=find_packages(),
32
+ platforms=["all"],
33
+ url='https://gitee.com/hoops/close-paving',
34
+ classifiers=[
35
+ 'Operating System :: OS Independent',
36
+ 'Intended Audience :: Science/Research',
37
+ 'Programming Language :: Python',
38
+ 'Programming Language :: Python :: Implementation',
39
+ 'Programming Language :: Python :: 3',
40
+ 'Programming Language :: Python :: 3.7',
41
+ 'Programming Language :: Python :: 3.8',
42
+ 'Programming Language :: Python :: 3.9',
43
+ 'Programming Language :: Python :: 3.10',
44
+ 'Programming Language :: Python :: 3.11',
45
+ 'Programming Language :: Python :: 3.12',
46
+ 'Programming Language :: Python :: 3.13',
47
+ 'Topic :: Software Development :: Libraries'
48
+ ],
49
+ install_requires=load_install_requires()
50
+ )