Created
November 16, 2015 19:57
-
-
Save Makazone/cdfe9b7adcde62d3190e to your computer and use it in GitHub Desktop.
Complex plain transformation, task 3 N = 8
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function [ output_args ] = untitled2( input_args ) | |
| figure | |
| hold on | |
| n = 8; % too lazy to hold shift | |
| center = (2*n+1 - 1i*n) / (n+5); | |
| radius = (n+3)/(2*n+1); | |
| % plot(real(center), imag(center), '.g') | |
| fromZ = @(z) abs(z-center); | |
| veryBigNumber = 10; | |
| fromG = zeros(veryBigNumber, veryBigNumber); | |
| toG = zeros(veryBigNumber, veryBigNumber); | |
| % for x = -3:0.05:3 | |
| % % for x = real(center)-radius-0.2:0.05:real(center)+radius+0.2 | |
| % for y = -3:0.05:3 | |
| % % for y = imag(center)-radius-0.2:0.05:imag(center)+radius+0.2 | |
| % z = x + 1i*y; | |
| % % abs(fromZ(z) - radius) | |
| % if (fromZ(z) > radius) | |
| % plot(x, y, '*r') | |
| % % fromG(x+veryBigNumber+1,y+veryBigNumber+1) = 1; | |
| % newZ = transform(z, radius, center, n); | |
| % % if (abs(real(newZ)) > 10 || abs(imag(newZ)) > 10) | |
| % % continue | |
| % % end | |
| % plot(real(newZ), imag(newZ), '*g') | |
| % else | |
| % end | |
| % end | |
| % end | |
| for fi = 0:0.01:2*pi | |
| z = center + radius*exp(1i*fi); | |
| newZ = transform(z, radius, center, n); | |
| % plot(real(z), imag(z), '*r') | |
| plot(real(newZ), imag(newZ), '*g') | |
| xlim([-0.3 3]) | |
| ylim([-6 1]) | |
| end | |
| end | |
| function [newZ] = transform(z, radius, center, n) | |
| % Move to (0,0) | |
| w(1) = z - center; | |
| % Transform to identity circle | |
| w(2) = w(1) * 1.0/radius; | |
| % Inverse | |
| w(3) = 1/w(2); | |
| % Make plane | |
| w(4) = 1i*(w(3)+1)/(1-w(3)); | |
| % Create angle | |
| angle = (-1)^n * (4*pi) / (5*n+3) - (-1)^(n+1)*(pi*(2*n+4)/(5*n+3)); | |
| w(5) = w(4)^(24/43); | |
| % Rotate | |
| w(6) = w(5)*exp(-1i*20*pi/43); | |
| % w(6) = w(5)*exp(-1i*pi/2); | |
| % Move | |
| w(7) = w(6)-(n*1i+n+1)/(2*n-1i*n); | |
| newZ = w(end); | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment