🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

map2d

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

map2d

map2d

Source
npmnpm
Version
0.0.13
Version published
Weekly downloads
0
-100%
Maintainers
1
Weekly downloads
 
Created
Source

2d格子地图

API

// 基本类型
// IPosition 2d坐标 {x:number,y:number}
// Direction 方向枚举,上右下左
// SlashDirection 斜向方向枚举,东北 东南 西南 西北

// 1 以posiSoure为原点,获取dire方向(直线)的dist个格子的坐标数组
lineRange(posiSource: IPosition, dist: number, dire: number): IPosition[];

// 2 以posiSoure为原点,获取dire方向(斜线)的dist个格子的坐标数组
slashRange(posiSource: IPosition, dist: number, dire: number): IPosition[];

// 3 周围直线4格(不包括自己)
nearRange(posiSource: IPosition, dist: Direction): IPosition[];

// 4 周围斜线4格(不包括自己)
nearSlashRange(posiSource: IPosition, dist: Direction): IPosition[];

// 5 周围一圈(不包括自己)
circleRange(posiSource: IPosition, radius: number): IPosition[];

// 6 曼哈顿距离(不包括自己)
manhattanRange(posiSource: IPosition, radius: number): IPosition[];

// 7 获取两点之间坐标
getBetween(pa: IPosition, pb: IPosition): IPosition[];

// 8 坐标去重
unique(posiList: IPosition[]): IPosition[];

// 9 差集运算
sub(posiListSource: IPosition[], posiListTarget: IPosition[]): IPosition[];

npm脚本

npm run compile

编译ts代码

npm run test

测试

Keywords

map

FAQs

Package last updated on 24 Nov 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts