Help rotating a rectangle (PsychToolbox)
5 ビュー (過去 30 日間)
古いコメントを表示
The program successfully draws a rectangle but I can't find any online resources that explain how to rotate it. Here is what I have so far:
%
function [ output_args ] = SubDetection( )
close all;
clear all;
PsychDefaultSetup(2);
screens = Screen('Screens');
screenNumber = max(screens);
white = WhiteIndex(screenNumber);
black = BlackIndex(screenNumber);
gray = white/2;
% Open an on screen window
[window, windowRect] = PsychImaging('OpenWindow', screenNumber, gray);
% Get the size of the on screen window
[screenXpixels, screenYpixels] = Screen('WindowSize', window);
Screen('BlendFunction', window, 'GL_SRC_ALPHA', 'GL_ONE_MINUS_SRC_ALPHA');
% Display instructions
messageStr='Please indicate with the left and right arrow keys \n whether the stimulus \n is a square (<-) or a circle (->) \n\n Press any key to begin.';
WaitSecs(0.5);
Screen('TextSize', window, 30);
DrawFormattedText(window, messageStr, 'center', 'center', [1 1 1]);
Screen('Flip',window,0,0);
KbStrokeWait;
% Get the centre coordinate of the window
[xCenter, yCenter] = RectCenter(windowRect);
% size of fixation cross
fixCrossDimPix = 8;
xCoords = [-fixCrossDimPix fixCrossDimPix 0 0];
yCoords = [0 0 -fixCrossDimPix fixCrossDimPix];
allCoords = [xCoords; yCoords];
lineWidthPix = 2;
Screen('DrawLines', window, allCoords,...
lineWidthPix, white, [xCenter yCenter], 2);
Screen('Flip', window);
WaitSecs(1);
[xCenter, yCenter] = RectCenter(windowRect);
baseRect = [0 0 50 175];
centeredRect = CenterRectOnPointd(baseRect, xCenter, yCenter);
rectColor = [0 0 0];
% Draw the rectangle
Screen('FillRect', window, rectColor, centeredRect);
Screen('Flip', window);
WaitSecs(1);
KbStrokeWait;
sca;
end
0 件のコメント
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Image display and manipulation についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!