From c3e3716e9a526e4402fff8740a67eee25ef6b04a Mon Sep 17 00:00:00 2001
From: Stephan Hilb <stephan@ecshi.net>
Date: Thu, 9 Dec 2021 22:15:15 +0100
Subject: [PATCH] fix init grid
---
src/mesh.jl | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/mesh.jl b/src/mesh.jl
index 7177c01..c3648f5 100644
--- a/src/mesh.jl
+++ b/src/mesh.jl
@@ -172,9 +172,11 @@ function init_grid(img::Array{<:Any, 2}; type=:vertex)
init_grid(s..., (0.5, 0.5), s .- (0.5, 0.5))
end
-function init_grid(img::Array{<:Any, 2}, m::Int, n::Int = m)
+function init_grid(img::Array{<:Any, 2}, m::Int, n::Int = m; type=:vertex)
s = (size(img, 2), size(img, 1))
- init_grid(m, n, (0.5, 0.5), s .- (0.5, 0.5))
+ type == :vertex ?
+ init_grid(((m, n) .- 1)..., (1.0, 1.0), s) :
+ init_grid((m, n)..., (0.5, 0.5), s .- (0.5, 0.5))
end
# horribly implemented, please don't curse me
--
GitLab