Flip the humidity axis
This commit is contained in:
parent
30d09d3a8e
commit
26a3523855
@ -762,14 +762,16 @@ function canvasPixelCoordsToBiomeCoords(x, y) {
|
||||
let w = (voronoiCanvas.width/(limit_heat_max-limit_heat_min));
|
||||
let h = (voronoiCanvas.height/(limit_humidity_max-limit_humidity_min));
|
||||
let heat = Math.round((x + limit_heat_min * w) / w);
|
||||
let humidity = Math.round((y + limit_humidity_min * h) / h);
|
||||
// This also flips the Y axis
|
||||
let humidity = limit_humidity_min + (limit_humidity_max - (Math.round((y + limit_humidity_min * h) / h)));
|
||||
return [heat, humidity];
|
||||
}
|
||||
function biomeCoordsToCanvasPixelCoords(heat, humidity) {
|
||||
let w = (voronoiCanvas.width/(limit_heat_max-limit_heat_min));
|
||||
let h = (voronoiCanvas.height/(limit_humidity_max-limit_humidity_min));
|
||||
let pixelX = heat * w - limit_heat_min * w;
|
||||
let pixelY = humidity * h - limit_humidity_min * h;
|
||||
// This also flips the Y axis
|
||||
let pixelY = voronoiCanvas.height - (humidity * h - limit_humidity_min * h);
|
||||
return [pixelX, pixelY];
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user