% Script triangles
% Draw a triangle and partition it depending on its area.

% Set up the window
close all % Close all previous figure windows
figure % Start a new figure window
hold on % Keep the same set of axes (multiple plots on same axes)
axis equal % unit lengths on x- and y-axis are equal
axis([0 10 0 10]) % x-axis limits [0,10], y-axis limits [0,10]

%%% Do not change the code above %%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Modify the code below %%%%%%%%%%

% First point
x1=3; y1=6;
plot(x1, y1, 'ko') % black circle

% Second point, connected to first point
x2=8.5; y2=7;
plot(x2, y2, 'm+') % magenta cross
plot([x1 x2],[y1 y2],'b') % blue line

% Third point, connected to the second
title('Click on the plot below')
[x3, y3]= ginput(1);
plot(x3, y3, 'k*') % black asterisk
plot([x3 x2],[y3 y2],'b:') % blue dotted line
messageToShow= sprintf('You clicked at (%.1f,%.1f)', x3, y3);
title(messageToShow)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Do not change the code below %%%

hold off