feat:提交
This commit is contained in:
37
tests/dev1/dataHandle/common/core/NestCache.ts
Normal file
37
tests/dev1/dataHandle/common/core/NestCache.ts
Normal file
@@ -0,0 +1,37 @@
|
||||
import type { Point } from '../Vector2'
|
||||
import { Path } from './Path'
|
||||
|
||||
export class NestCache
|
||||
{
|
||||
static count1 = 0
|
||||
static count2 = 0// noset
|
||||
|
||||
static PositionCache: { [key: string]: Point } = {}
|
||||
static NoPutCache: { [key: string]: Set<number> } = {}
|
||||
private static CacheRect = new Map<string, Path>()
|
||||
|
||||
/**
|
||||
* 用于创建原点在0点的矩形路径
|
||||
*/
|
||||
static CreatePath(x: number, y: number, knifRadius = 3.5): Path
|
||||
{
|
||||
let minX = -knifRadius
|
||||
let maxX = x + knifRadius
|
||||
let minY = -knifRadius
|
||||
let maxY = y + knifRadius
|
||||
return new Path([
|
||||
{ x: minX, y: minY },
|
||||
{ x: maxX, y: minY },
|
||||
{ x: maxX, y: maxY },
|
||||
{ x: minX, y: maxY },
|
||||
])
|
||||
}
|
||||
|
||||
static Clear()
|
||||
{
|
||||
this.count1 = 0
|
||||
this.count2 = 0
|
||||
this.CacheRect.clear()
|
||||
this.PositionCache = {}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user