mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 17:51:24 +01:00
fix exact multiple error for spacing (#776)
Co-authored-by: Mészáros Gergely <monk@geotronic.hu>
This commit is contained in:
parent
4447826c00
commit
73434f5bb7
1 changed files with 2 additions and 2 deletions
4
main.js
4
main.js
|
|
@ -760,8 +760,8 @@ function placePoints() {
|
||||||
const spacing = (grid.spacing = rn(Math.sqrt((graphWidth * graphHeight) / cellsDesired), 2)); // spacing between points before jirrering
|
const spacing = (grid.spacing = rn(Math.sqrt((graphWidth * graphHeight) / cellsDesired), 2)); // spacing between points before jirrering
|
||||||
grid.boundary = getBoundaryPoints(graphWidth, graphHeight, spacing);
|
grid.boundary = getBoundaryPoints(graphWidth, graphHeight, spacing);
|
||||||
grid.points = getJitteredGrid(graphWidth, graphHeight, spacing); // jittered square grid
|
grid.points = getJitteredGrid(graphWidth, graphHeight, spacing); // jittered square grid
|
||||||
grid.cellsX = Math.floor((graphWidth + 0.5 * spacing) / spacing);
|
grid.cellsX = Math.floor((graphWidth + 0.5 * spacing - 1e-10) / spacing);
|
||||||
grid.cellsY = Math.floor((graphHeight + 0.5 * spacing) / spacing);
|
grid.cellsY = Math.floor((graphHeight + 0.5 * spacing - 1e-10) / spacing);
|
||||||
TIME && console.timeEnd("placePoints");
|
TIME && console.timeEnd("placePoints");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue