Skip to content

Commit

Permalink
small fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Archontis Politis committed Oct 19, 2016
1 parent 8360a11 commit 69f15c6
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 13 deletions.
15 changes: 11 additions & 4 deletions Fdirs2grid.m
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,17 @@
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

phi = (0:aziRes:360-aziRes)*pi/180;
theta = (0:polarRes:180)*pi/180;
Nphi = length(phi);
Ntheta = length(theta);
if mod(360, aziRes) ~= 0 || mod(180, polarRes) ~= 0
error('azimuth or elevation resolution should divide exactly 360 and 180deg')
end

if nargin<4
CLOSED = 0;
end

Nphi = 360/aziRes;
Ntheta = 180/polarRes+1;

Nf = size(W, 2);
Wgrid = zeros(Nphi, Ntheta, Nf);
for i = 1:Nf
Expand Down
2 changes: 1 addition & 1 deletion getSHrotMtx.m
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
basisType = 'real';
end
% allocate total rotation matrix
R = zeros(L+1)^2;
R = zeros((L+1)^2);

% initialize zeroth and first band rotation matrices for recursion
% Rxyz = [Rxx Rxy Rxz
Expand Down
35 changes: 27 additions & 8 deletions grid2dirs.m
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function dirs = grid2dirs(aziRes, polarRes)
function dirs = grid2dirs(aziRes, polarRes, POLAR_OR_ELEV, ZEROED_OR_CENTERED)
%GRID2DIRS Create a vector of spherical grid points
%
% Grid2dirs creates a vector of a spherical grid directions, based on a
Expand All @@ -13,18 +13,37 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

if mod(360, aziRes) ~= 0 || mod(180, polarRes) ~= 0
error('azimuth or elevation resolution should divide exactly 180 and 150deg')
error('azimuth or elevation resolution should divide exactly 360 and 180deg')
end

phi = (0:aziRes:360-aziRes)*pi/180;
theta = (0:polarRes:180)*pi/180;
switch nargin
case 3
ZEROED_OR_CENTERED = 1;
case 2
ZEROED_OR_CENTERED = 1;
POLAR_OR_ELEV=1;
case {1,0}
error('Not enough arguments');
end

if ZEROED_OR_CENTERED, phi = (0:aziRes:360-aziRes)*pi/180;
else phi = (-180:aziRes:180-aziRes)*pi/180;
end

if POLAR_OR_ELEV, theta = (0:polarRes:180)*pi/180; % polar angle
else theta = (-90:polarRes:90)*pi/180; % elevation angle
end
Nphi = length(phi);
Ntheta = length(theta);

dirs(1, :) = [0 0];
for i=2:Ntheta-1

for i=2:Ntheta-1
dirs((i-2)*Nphi + (1:Nphi) + 1, :) = [phi' theta(i)*ones(size(phi'))];
end

dirs(end+1,:) = [0 pi];
if POLAR_OR_ELEV
dirs(1, :) = [0 0];
dirs(end+1,:) = [0 pi];
else
dirs(1, :) = [0 -pi/2];
dirs(end+1,:) = [0 pi/2];
end

0 comments on commit 69f15c6

Please sign in to comment.