How to map two rectangles in matlab?
Mostrar comentarios más antiguos
So I am trying to map two rectangles so whenever I click a point in one rectangle, it will show the corresponding point in the second rectangle. I am new to matlab so I get lost in the program kind of easily.
I create two rectangles using ginput with:
[x,y]=ginput(2);
key=get(gcf,'CurrentKey');
if (key == 'return')
done=0;
end;
rectangle ('Position', [x(1) y(1) x(2)-x(1) y(2)-y(1)],...
'EdgeColor', 'b',...
'LineWidth', 2, 'LineStyle', '--');
[x1,y1]=ginput(2);
key=get(gcf,'CurrentKey');
if (key == 'return')
done=0;
end;
rectangle ('Position', [x1(1) y1(1) x1(2)-x1(1) y1(2)-y1(1)],...
'EdgeColor', 'r',...
'LineWidth', 2, 'LineStyle', '--');
This gives me a blue rectangle and a red rectangle. Now I am just completely confused on how I can go about actually working this out. Basically if I click inside the blue rectangle I want the corresponding point of the red rectangle to be calculated and plotted as well. Any ideas? Thanks!
Respuestas (0)
Categorías
Más información sobre Graphics Performance en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!