# How to rotate polar radius to boundaries?

4 views (last 30 days)
SL on 21 Oct 2016
I am thinking if there is any method to rotate origo to boundaries and boundaries to origo. The related thread has the relevant code and example about the situation. My pseudocode is
1. put mirror on the boundaries
2. mirror the all points outside of the circle
3. shrinkage now the empty space in the circle; the points should now be in the circle
I think there exists mathematically more rigorous way to do it. The related thread is about Mathematics of the case. However, there may be already something relevant integrated in MATLAB.
Code
close all; clear all; clc;
% http://stackoverflow.com/q/40030096/54964
fp2 = figure('Name', 'Test YX', ...
'Position',[200 200 851 404],'Resize','off'); % only half circle in polaraxes although warp can do eclipses
ThetaTicks = 0*pi:pi/10:2*pi;
pax2 = polaraxes( 'ThetaAxisUnits', 'radians', ...
'ThetaLim',[min(ThetaTicks) max(ThetaTicks)],...
'Color','none',...
'GridAlpha',1,...
'GridColor',[1 1 1],...
'ThetaTick',ThetaTicks, ...
'Parent', fp2);
imax2 = axes('Parent', fp2, 'Visible', 'off');
imax2.Children = warp(x, y, z, I);
set(imax2,'view',[-180 -90],'Visible','off')
% http://stackoverflow.com/a/7586650/54964
[h,w,~] = size(img);
s = min(h,w)/2;
[x,y] = pol2cart(theta, rho);
z = zeros(size(x));
end
MATLAB: 2016b OS: Debian 8.5 Related: http://mathoverflow.net/q/252770/42613

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by