


convert to polar data and sort for increasing angles The input data is converted to polar coordinates. The polar angle is in the range [0, 2pi). THIS IS NO USER FUNCTION


0001 function [polarAngle, polarDistance] = convertCartToPolar(cartX, cartY) 0002 % convert to polar data and sort for increasing angles 0003 % 0004 % The input data is converted to polar coordinates. The polar angle is in 0005 % the range [0, 2pi). 0006 % 0007 % THIS IS NO USER FUNCTION 0008 0009 % The elk-library: convex geometry applied to crystallization modeling. 0010 % Copyright (C) 2012 Alexander Reinhold 0011 % 0012 % This program is free software: you can redistribute it and/or modify it 0013 % under the terms of the GNU General Public License as published by the 0014 % Free Software Foundation, either version 3 of the License, or (at your 0015 % option) any later version. 0016 % 0017 % This program is distributed in the hope that it will be useful, but 0018 % WITHOUT ANY WARRANTY; without even the implied warranty of 0019 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0020 % General Public License for more details. 0021 % 0022 % You should have received a copy of the GNU General Public License along 0023 % with this program. If not, see <http://www.gnu.org/licenses/> 0024 0025 %% conversion 0026 polarDistance = sqrt(cartX.^2 + cartY.^2); 0027 polarAngle = mod(atan2(cartY, cartX), 2*pi);