refactor: voronoi

This commit is contained in:
Azgaar 2022-07-12 02:11:03 +03:00
parent e59b536e83
commit 00d8d28d76
16 changed files with 1912 additions and 171 deletions

View file

@ -12,7 +12,7 @@ interface IGraphVertices {
interface IGraphCells {
i: UintArray;
b: UintArray;
b: (0 | 1)[];
c: number[][];
v: number[][];
}

9
src/types/pack.d.ts vendored
View file

@ -1,5 +1,5 @@
interface IPack extends IGraph {
cells: IPackCells;
cells: IGraphCells & IPackCells;
features: TPackFeatures;
states: IState[];
cultures: ICulture[];
@ -9,7 +9,7 @@ interface IPack extends IGraph {
religions: IReligion[];
}
interface IPackCells extends IGraphCells {
interface IPackCells {
p: TPoints; // cell center points
h: Uint8Array; // heights, [0, 100], see MIN_LAND_HEIGHT constant
t: Int8Array; // see DISTANCE_FIELD enum
@ -32,6 +32,11 @@ interface IPackCells extends IGraphCells {
q: d3.Quadtree<number[]>;
}
interface IPackBase extends IGraph {
cells: IGraphCells & Partial<IPackCells>;
features?: TPackFeatures;
}
interface IPackFeatureBase {
i: number; // feature id starting from 1
border: boolean; // if touches map border