Hi all,
I'm drawing 4 rectangles with randomized rotations. They seem randomized in terms of their angels, however I need each one to be a little bit different than others. The rotated angle of the rectangles should not be close to each other, they all should be at least 10 degrees apart. And this also should be randomized. How can I define this? Thank you!
This is how I draw the rectangles:
rot_angle1=randi(360);
rot_angle2=randi(360);
rot_angle3=randi(360);
rot_angle4=randi(360);
rect_array=255*ones(1,1);
t1=Screen('MakeTexture',w,rect_array);
t2=Screen('MakeTexture',w,rect_array);
t3=Screen('MakeTexture',w,rect_array);
t4=Screen('MakeTexture',w,rect_array);
t5=Screen('MakeTexture',w,rect_array);
destrect(1,:) = (ul_c + stim_array);
destrect(2,:) = (ur_c + stim_array);
destrect(3,:) = (ll_c + stim_array);
destrect(4,:) = (lr_c + stim_array);
Screen('DrawTexture',w,t2,[],destrect(1,:),rot_angle1);
Screen('DrawTexture',w,t3,[],destrect(2,:),rot_angle2);
Screen('DrawTexture',w,t4,[],destrect(3,:),rot_angle3);
Screen('DrawTexture',w,t5,[],destrect(4,:),rot_angle4);
Screen('Flip',w);
I'm drawing 4 rectangles with randomized rotations. They seem randomized in terms of their angels, however I need each one to be a little bit different than others. The rotated angle of the rectangles should not be close to each other, they all should be at least 10 degrees apart. And this also should be randomized. How can I define this? Thank you!
This is how I draw the rectangles:
rot_angle1=randi(360);
rot_angle2=randi(360);
rot_angle3=randi(360);
rot_angle4=randi(360);
rect_array=255*ones(1,1);
t1=Screen('MakeTexture',w,rect_array);
t2=Screen('MakeTexture',w,rect_array);
t3=Screen('MakeTexture',w,rect_array);
t4=Screen('MakeTexture',w,rect_array);
t5=Screen('MakeTexture',w,rect_array);
destrect(1,:) = (ul_c + stim_array);
destrect(2,:) = (ur_c + stim_array);
destrect(3,:) = (ll_c + stim_array);
destrect(4,:) = (lr_c + stim_array);
Screen('DrawTexture',w,t2,[],destrect(1,:),rot_angle1);
Screen('DrawTexture',w,t3,[],destrect(2,:),rot_angle2);
Screen('DrawTexture',w,t4,[],destrect(3,:),rot_angle3);
Screen('DrawTexture',w,t5,[],destrect(4,:),rot_angle4);
Screen('Flip',w);