Files
cut-abstractions/tests/dev1/dataHandle/common/core/NestCache.ts
2025-07-22 18:22:31 +08:00

38 lines
820 B
TypeScript

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 = {}
}
}