mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 17:51:24 +01:00
refactor: detect feature vertex
This commit is contained in:
parent
3410c48c58
commit
1888b04d54
4 changed files with 116 additions and 43 deletions
|
|
@ -47,12 +47,15 @@ export function calculateVoronoi(points: TPoints, boundary: TPoints): IGraph {
|
|||
|
||||
// add points along map edge to pseudo-clip voronoi cells
|
||||
function getBoundaryPoints(width: number, height: number, spacing: number) {
|
||||
const offset = rn(-1 * spacing);
|
||||
const offset = rn(spacing * -1.5);
|
||||
|
||||
const bSpacing = spacing * 2;
|
||||
const w = width - offset * 2;
|
||||
const h = height - offset * 2;
|
||||
|
||||
const numberX = Math.ceil(w / bSpacing) - 1;
|
||||
const numberY = Math.ceil(h / bSpacing) - 1;
|
||||
|
||||
const points: TPoints = [];
|
||||
|
||||
for (let i = 0.5; i < numberX; i++) {
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@ import {calculateVoronoi} from "scripts/generation/graph";
|
|||
import {createTypedArray} from "utils/arrayUtils";
|
||||
import {pick} from "utils/functionUtils";
|
||||
import {rn} from "utils/numberUtils";
|
||||
import {rankCells} from "../rankCells";
|
||||
|
||||
const {LAND_COAST, WATER_COAST, DEEPER_WATER} = DISTANCE_FIELD;
|
||||
const {Lakes, OceanLayers, Rivers, Biomes, Cultures, BurgsAndStates, Religions, Military, Markers, Names} = window;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue