Hello,
My goal is make an experiment in which an 90 deg angle is shown in the center of the center of the screen with random orientation.
If position of line is (0,0) its` center is located at the center of the monitor. Since the angle should appear at the center the position stimuli should be changed with each orientation.
An orientation of the first line is random and an orientation of the second line ±90deg relative to the first line’s orientation.
To control position the lines should be offset from the centre of the screen by half its length at the same angle. So, xpos = cos(x)*length/2, ypos = sin(x)*length/2, where x is orientation in radians.
However, I have a problem, and I can’t figure out where I made a mistake. In my experiment lines are shown with 90 deg relative orientation between each other, but they do not meet in the center of the screen and form an angle. (See screenshots)
I use builder with additional code component
Here is my code:
Before experiment:
mywin = visual.Window([1280,720],monitor=“testMonitor”, units=“deg”)
line1= visual.Line(mywin, start=(0,0)) #I tried to set up the start of both lines at the center of the screen in coder, but it didn`t work out
line2= visual.Line(mywin, start=(0,0))
corner=90
Begin routine:
#seting up relative 90 deg orientation between lines
orient1 = random.randint(0,360) #orientation of the first line
ops= (add, sub)
op = random.choice(ops)
orient2 = op(orient1, corner) #orientation of the second line
#seting up position of line
x1=np.radians(orient1) #changing to radians
x2=np.radians(orient2)
#the line length is 7 so sin and cos are multiplied by 3.5
pos1=( cos(x1)*3.5, sin(x1)*3.5) #position of the first line
pos2=( cos(x2)*3.5, sin(x2)*3.5) #position of the second line
I would be very grateful for your help.