Code covered by the BSD License  

Highlights from
RotorDraw

image thumbnail

RotorDraw

by

 

29 Oct 2012 (Updated )

This script creates coordinates for patterns that are similar to those created by a "Spirograph".

CalculatePenPosition(A_x_global,A_y_global,C_x_global,C_y_global,extension )
%% "Spirograph" Code
%  Jonathan Jamieson - September 2013
%  unigamer@gmail.com
%  www.jonathanjamieson.com

function [P_x_global,P_y_global ] = CalculatePenPosition(A_x_global,A_y_global,C_x_global,C_y_global,extension  )

dx = C_x_global-A_x_global;
dy = C_y_global-A_y_global;

theta = atan2(dy,dx);

P_x_global = extension*cos(theta)+C_x_global;
P_y_global = extension*sin(theta)+C_y_global;

end

Contact us