diff --git a/mods/CORE/MapGen/src/MapGen/Triangle.lua b/mods/CORE/MapGen/src/MapGen/Triangle.lua index 42ac035..02ceda8 100644 --- a/mods/CORE/MapGen/src/MapGen/Triangle.lua +++ b/mods/CORE/MapGen/src/MapGen/Triangle.lua @@ -280,12 +280,14 @@ function Triangle:getCircumCircle2D() return c, r end +---@alias MapGen.Triangle.CircumCircleEnum 'IN'|'BEHIND'|'ON' + ---Checks if a given point lies into the triangle circumcircle. --- ---Note: This function does not take into account the Y-coordinate, ---that is, the calculation is performed on the projection of the triangle XZ. ---@param p MapGen.Peak ----@return boolean +---@return MapGen.Triangle.CircumCircleEnum function Triangle:inCircumCircle2D(p) local pos = p:getPeakPos() @@ -293,7 +295,14 @@ function Triangle:inCircumCircle2D(p) local distance = (c - pos):length() - return distance <= r + + if distance - r < 1e-10 then + return 'ON' + elseif distance < r then + return 'IN' + else + return 'BEHIND' + end end return Triangle diff --git a/mods/CORE/MapGen/src/MapGen/Triangulation.lua b/mods/CORE/MapGen/src/MapGen/Triangulation.lua index 1ea6f8f..7c05483 100644 --- a/mods/CORE/MapGen/src/MapGen/Triangulation.lua +++ b/mods/CORE/MapGen/src/MapGen/Triangulation.lua @@ -119,7 +119,7 @@ function Triangulation.triangulate( vertices ) for j = #triangles, 1, -1 do local curTriangle = triangles[j] - if curTriangle:inCircumCircle2D(vertices[i]) then + if curTriangle:inCircumCircle2D(vertices[i]) == 'IN' then edges[#edges + 1] = curTriangle.e1 edges[#edges + 1] = curTriangle.e2 edges[#edges + 1] = curTriangle.e3 diff --git a/mods/ENVIRONMENT/mapGenerator/src/mapGenerator.lua b/mods/ENVIRONMENT/mapGenerator/src/mapGenerator.lua index cb93de2..62859e4 100644 --- a/mods/ENVIRONMENT/mapGenerator/src/mapGenerator.lua +++ b/mods/ENVIRONMENT/mapGenerator/src/mapGenerator.lua @@ -137,32 +137,28 @@ mapGenerator:register2DPeaks('midgard', for _, c in ipairs({'landscape', 'temp', 'humidity'}) do mapGenerator:registerLayerNoiseColor('midgard', c, '#4978c6', land1) mapGenerator:registerLayerNoiseColor('midgard', c, '#77ea72', land2) ---[[ + --[[ mapGenerator:register2DPeaks('midgard', c, { { color = '#77ea72', pos = vector.new(512, 0, 512) }, { - color = '#77ea72', + color = '#4978c6', pos = vector.new(512, 0, -512) }, { color = '#77ea72', pos = vector.new(-512, 0, -512) }, - { - color = '#77ea72', - pos = vector.new(-512, 0, 512) - }, { color = '#4978c6', - pos = vector.new(0, 0, 0) + pos = vector.new(-512, 0, 512) }, })--]] end -mapGenerator:register2DPeaksFromFile('midgard', 'map.ff', 100,{x=0, y=0}, 'landscape') +mapGenerator:register2DPeaksFromFile('midgard', 'map.ff', 50,{x=0, y=0}, 'landscape') mapGenerator:register2DPeaksFromFile('midgard', 'map.ff', 150,{x=0, y=0}, 'temp') mapGenerator:register2DPeaksFromFile('midgard', 'map.ff', 200,{x=0, y=0}, 'humidity') diff --git a/mods/ENVIRONMENT/mapGenerator/textures/maps/map.ff b/mods/ENVIRONMENT/mapGenerator/textures/maps/map.ff index dcbda9d..87cd045 100644 Binary files a/mods/ENVIRONMENT/mapGenerator/textures/maps/map.ff and b/mods/ENVIRONMENT/mapGenerator/textures/maps/map.ff differ