How do I rotate a square (rectangle) to make a diamond?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Michael Faulks
am 4 Feb. 2017
Beantwortet: Walter Roberson
am 5 Feb. 2017
I'm trying to rotate a purple square into a purple diamond. I am working with PsychToolBox and a template of code that already successfully draws a purple square. How do I rotate the square 45 degrees to make a diamond using a format similar to the one used in the code for a square? I've included the relevant parts of the code below, but I am pretty new to MatLab and working with a very large script so I may have missed something.
Image of Code attached

0 Kommentare
Akzeptierte Antwort
Walter Roberson
am 5 Feb. 2017
The closest I can find in Psychtoolbox is FramePoly. You would need the points of the polygon vertex. Those are not difficult to calculate for the case of a square rotated 45 degrees:
sq = sqrt(2);
x = [sq, 0, -sq, 0, sq]
y = [0, sq, 0, -sq, 0];
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Image display and manipulation finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!