function draw_wafer(translation, angle, laser) d = 75; % diameter f = 36; % distance of flat from center a = acos(f/(d/2)); % half angle opening of the flat % build wafer in reference position and orientation phi = [linspace(a, pi-a, 100), linspace(pi+a, 2*pi-a, 100)]; coordinates = [-d/2*cos(phi); d/2*sin(phi)]'; coordinates(end+1,:) = coordinates(1,:); % rotate angle = angle/180*pi; rot = [cos(angle), sin(angle); -sin(angle), cos(angle)]; coordinates = (rot * coordinates')'; % translate coordinates(:,1) = coordinates(:,1) + translation; % plot wafer plot(coordinates(:,1), coordinates(:,2), 'LineWidth', 2); axis equal grid on % plot center hold all plot(translation, 0, 'x', 'LineWidth', 2); xlim([-60, 70]) ylim([-40, 40]) % plot laser spot l = plot(laser(1), laser(2), 'ro'); l.MarkerFaceColor = l.Color; hold off end