Skip to content
Snippets Groups Projects

Update geometry generation functions

Merged Imported Achilles Kappis requested to merge UpdateGeo into main
4 files
+ 44
84
Compare changes
  • Side-by-side
  • Inline
Files
4
@@ -3,7 +3,7 @@
% Author: Achilles Kappis
% e-mail: axilleaz@protonmail.com
%
% Date: 30/07/2024 (DD/MM/YYYY)
% Date: 20/09/2024 (DD/MM/YYYY)
%
% Copyright: MIT
% --------------------------------------------------
@@ -45,14 +45,10 @@
% respective output variables are
% empty. [Default: 0.05].
%
% xOff [numeric] (Optional): An offset along the x-axis of the microphone
% configuration. [Default: 0].
%
% yOff [numeric] (Optional): An offset along the y-axis of the microphone
% configuration. [Default: 0].
%
% zOff [numeric] (Optional): An offset along the z-axis of the microphone
% configuration. [Default: 0].
% trans [numeric] (Optional): This is a real vector with three elements,
% representing the translation of the geometry
% along the Cartesian axes.
% [Default: zeros(3, 1)].
%
% --------------------------------------------------
% Output
@@ -222,11 +218,11 @@
% - Dependencies: rotMat3d() to rotate the configurations
%
% --------------------------------------------------
function [omniPos, fig8Pos, triPos, boxPos, box2DPos, tetPos, fig8Vec, triangleVec, boxVec, box2DVec, tetVec] = rcvGeo(gType, nSens, elemDist, dmaElemDist, xOff, yOff, zOff)
function [omniPos, fig8Pos, triPos, boxPos, box2DPos, tetPos, fig8Vec, triangleVec, boxVec, box2DVec, tetVec] = rcvGeo(gType, nSens, elemDist, dmaElemDist, trans)
% ====================================================
% Check for number of arguments
% ====================================================
narginchk(1, 7);
narginchk(1, 5);
nargoutchk(0, 11);
% ====================================================
@@ -237,22 +233,10 @@ function [omniPos, fig8Pos, triPos, boxPos, box2DPos, tetPos, fig8Vec, triangleV
validatestring(gType, ["Single", "ULA", "UCA", "Log"], mfilename, "Geometry type", 1);
% Validate optional arguments
if nargin > 6 && ~isempty(zOff)
validateattributes(zOff, "numeric", {'scalar', 'real', 'nonnan', 'finite'}, mfilename, "Z offset of the microphone setup", 7);
else
zOff = 0;
end
if nargin > 5 && ~isempty(yOff)
validateattributes(yOff, "numeric", {'scalar', 'real', 'nonnan', 'finite'}, mfilename, "Y offset of the microphone setup", 6);
else
yOff = 0;
end
if nargin > 4 && ~isempty(xOff)
validateattributes(xOff, "numeric", {'scalar', 'real', 'nonnan', 'finite'}, mfilename, "X offset of the microphone setup", 5);
if nargin > 4 && ~isempty(trans)
validateattributes(trans, "numeric", {'vector', 'real', 'nonnan', 'finite', 'nonempty', 'numel', 3}, mfilename, "The translation of the the geometry", 7);
else
xOff = 0;
trans = zeros(3, 1);
end
if nargin > 3 && ~isempty(dmaElemDist)
@@ -303,7 +287,7 @@ function [omniPos, fig8Pos, triPos, boxPos, box2DPos, tetPos, fig8Vec, triangleV
% Translate
if nargout > 0
omniPos = omniPos + [xOff, yOff, zOff];
omniPos = omniPos + trans(:).';
end
return;
end
@@ -408,29 +392,12 @@ function [omniPos, fig8Pos, triPos, boxPos, box2DPos, tetPos, fig8Vec, triangleV
% ====================================================
% Translate geometries
% ====================================================
if nargout > 0
omniPos = omniPos + [xOff, yOff, zOff];
end
if nargout > 1
fig8Pos = fig8Pos + [xOff, yOff, zOff];
end
if nargout > 2
triPos = triPos + [xOff, yOff, zOff];
end
if nargout > 3
boxPos = boxPos + [xOff, yOff, zOff];
end
if nargout > 4
box2DPos = box2DPos + [xOff, yOff, zOff];
end
if nargout > 5
tetPos = tetPos + [xOff, yOff, zOff];
end
omniPos = omniPos + trans(:).';
fig8Pos = fig8Pos + trans(:).';
triPos = triPos + trans(:).';
boxPos = boxPos + trans(:).';
box2DPos = box2DPos + trans(:).';
tetPos = tetPos + trans(:).';
% Provide a Nx3 "Figure-of-Eight" matrix
if nargout > 6
Loading