SLGFov
SLG游戏大地图的相关的基础算法,包含FOV,Bresenham算法
Install / Use
/learn @kyle-wang/SLGFovREADME
说明
- 这是一个为SLG游戏的大地图可视范围内的行军行为提供基础计算函数的golang库,默认所有的坐标点都处于第一象限
Package说明
- CheckIntersectSquareAndBeeline 函数实现判断一条行军线是否穿过某个视野区域
- Chart结构体定义了起点和终点(对角线点),直线和矩形都用同样的结构表示
- 如果直线穿过定义的矩形区域,返回true,否则返回false
- Bresenham 函数计算一条直线经过哪些坐标块
- 函数返回值[]PointCoordinate,返回经过的所有坐标块
- 输入参数不限定直线方向,但是依然只能是处于第一象限的坐标
使用方法
- go get github.com/kyle-wang/SLGFov
- SLGFov.CheckIntersectSquareAndBeeline(squre,beeline)
- SLGFov.Bresenham(x1, y1, x2, y2)
- x1,y1为起点坐标,x2,y2为终点坐标
Related Skills
node-connect
347.0kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
107.8kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
347.0kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
347.0kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
