From d33eccf072332aa6fe5bc18cf88309a210a16112 Mon Sep 17 00:00:00 2001 From: zymon Date: Sat, 18 Nov 2023 23:42:12 +0100 Subject: [PATCH] new array geometry generator --- src/TxRxModels.jl | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/TxRxModels.jl b/src/TxRxModels.jl index 910e979..3461c17 100644 --- a/src/TxRxModels.jl +++ b/src/TxRxModels.jl @@ -1,5 +1,6 @@ module TxRxModels +using Statistics using LinearAlgebra using StaticArrays @@ -198,6 +199,12 @@ function circular_array(N::Integer, r::Real) [SVector{3}([r * cos(α), r * sin(α), 0]) for α ∈ 0:Δα:2π-Δα] end +function square_array(N::I, M::I, Lx::T, Ly::T) where {I<:Integer, T<:Real} + Δx, Δy = Lx / N, Ly / N + p = [SVector{3}([Δx*i, Δy*j, 0.0]) for i = 1:N for j = 1:M] + p .- [mean(p)] +end + function fibonacci_array(N::Integer, r::Real) P = fibonacci_sphere(N) [SVector{3}(r .* p) for p in P]