From d51b44f873e63da9654b2609f17ca651e92caec9 Mon Sep 17 00:00:00 2001 From: gitee-bot Date: Tue, 14 Oct 2025 11:06:19 +0000 Subject: [PATCH] Update README.md --- README.md | 105 +++++++++++++++++++++++++++++++++++------------------- 1 file changed, 69 insertions(+), 36 deletions(-) diff --git a/README.md b/README.md index 5b48fdb..ca89b64 100644 --- a/README.md +++ b/README.md @@ -7,73 +7,106 @@ ![licence](https://img.shields.io/pypi/l/close-paving.svg) ![status](https://img.shields.io/pypi/status/close-paving.svg) +## 介绍 -#### 介绍 +close-paving 是一个简单实用的六角形网格实现库,适用于需要六边形网格布局的应用场景,如地图绘制、游戏开发、数据可视化等。 -一个简单实用的六角形网格实现 +## 软件架构 -#### 软件架构 -软件架构说明 +项目采用模块化设计,主要模块如下: -- core -- error -- kernel -- plot_helper -- test +- **core**: 核心类定义,包括六边形、网格等基础结构。 +- **error**: 自定义异常类。 +- **kernel**: 提供生成六边形核的方法。 +- **plot_helper**: 提供绘图辅助函数,支持使用 matplotlib 绘制六边形和网格。 +- **test**: 单元测试模块,覆盖六边形、网格及其功能的测试。 +## 安装教程 -#### 安装教程 +### 通过 PyPI 安装 -1. pypi安装 -```commandline -python install close-paving +```bash +pip install close-paving ``` -2. 源码安装 +### 源码安装 -- 克隆仓库 -```commandline -git clone https://gitcode.net/astar/a.star/close-paving.git -``` - -或者 +1. 克隆仓库: -```commandline +```bash git clone https://gitee.com/hoops/close-paving.git ``` +2. 进入项目目录: - -- 跳转目录 -```commandline +```bash cd close_paving ``` -- 下载依赖 -```commandline + +3. 安装依赖: + +```bash pip install -r requirements.txt ``` +4. 安装项目: +```bash +python setup.py install +``` +## 使用说明 +close-paving 提供了创建六边形和六边形网格的功能,并支持绘制图形。 -- 运行安装命令 -```commandline -python setup.py install +### 创建六边形 + +```python +from close_paving.core.hexagon import HorizontalHexagon, VerticalHexagon + +# 创建一个水平方向的六边形 +hexagon = HorizontalHexagon(center=(0, 0), radius=1.0) + +# 创建一个垂直方向的六边形 +hexagon = VerticalHexagon(center=(0, 0), radius=1.0) +``` + +### 创建六边形网格 + +```python +from close_paving.core.hexagonal_grid import HexagonGrid + +# 创建一个垂直方向的六边形网格 +grid = HexagonGrid(seed=(0, 0), radius=1.0, shape=(5, 5), direction=Direction.vertical) ``` +### 绘制六边形和网格 +```python +from close_paving.plot_helper.plot_helper import plot_hexagon, plot_hexagonal_grid +import matplotlib.pyplot as plt -#### 使用说明 +# 绘制单个六边形 +plot_hexagon(hexagon) +plt.show() + +# 绘制六边形网格 +plot_hexagonal_grid(grid) +plt.show() +``` +## 参与贡献 -![direction type](./docs/images/direction.png) +1. Fork 本仓库。 +2. 新建 Feat_xxx 分支。 +3. 提交代码。 +4. 新建 Pull Request。 +## 许可证 -#### 参与贡献 +本项目采用 MIT 许可证。详情请查看 [LICENSE](LICENSE) 文件。 -1. Fork 本仓库 -2. 新建 Feat_xxx 分支 -3. 提交代码 -4. 新建 Pull Request +## 版本发布 +当前版本:v0.1 +详情请查看 [版本发布说明](docs/version/version_release_v0.1.md)。 \ No newline at end of file -- Gitee