dividing 360 angular degree by 6

Hi,

I would like to present 6 stimuli on 6 different locations on the imaginary circle array surrounding the fixation on the 800 x 600 display.

I am looking for a PTB code, which can divide this imaginary circle array by 6 (so each angular degree should be 60).

If I were using the E-Basic script for E-prime, I could do something like below:

To present 6 stimuli on an imaginary circle, set up an angular degree variable as q = 60

For counter = 1 to 6,
Xchange(counter) = (MemoryRadius* (sin((q)*(3.14)/180)))
Ychange(counter) = (MemoryRadius * (cos((q)*(3.14)/180)))

XPos(counter) = int(400 + Xchange(counter))
Ypos(counter) = int(300 - Ychange(counter))

q=q+60

Next counter

Is there any similar code for PTB?

Alternatively, is there any easy way to calculate xy coordinates for each of these locations once the retina eccentricity is set?

Thank you so much for your help.
Hi Mart,

It's probably easiest to use polar coordinates. Instead of doing it by hand as you currently do, you can use Matlab's convenience functions pol2cart and cart2pol for conversion between polar and Cartesian coordinate systems. Use like below.

Best,
Jochen

%
nCircles = 6; % how many equally spaced circles?
cx = 400; % x coordinates of center, in Pixels
cy = 300; % y coordinates of center, in Pixels
MemoryRadius = 100; % radius, in Pixels

% use polar coordinates to compute positions
dAngle = 2*pi/nCircles; % change in angle per circle
angles = (0:nCircles-1) * dTheta;
[xPos, yPos] = pol2cart(angles, MemoryRadius); % convert back to Cartesian

% translate to new center
xPos = xPos + cx;
yPos = yPos + cy;

% visualize
plot(xPos, yPos, 'o');
xlim([cx-1.5*MemoryRadius, cx+1.5*MemoryRadius]);
ylim([cy-1.5*MemoryRadius, cy+1.5*MemoryRadius]);




On Sep 8, 2011, at 20:03 , mart.pink wrote:

> Hi,
>
> I would like to present 6 stimuli on 6 different locations on the imaginary circle array surrounding the fixation on the 800 x 600 display.
>
> I am looking for a PTB code, which can divide this imaginary circle array by 6 (so each angular degree should be 60).
>
> If I were using the E-Basic script for E-prime, I could do something like below:
>
> To present 6 stimuli on an imaginary circle, set up an angular degree variable as q = 60
>
> For counter = 1 to 6,
> Xchange(counter) = (MemoryRadius* (sin((q)*(3.14)/180)))
> Ychange(counter) = (MemoryRadius * (cos((q)*(3.14)/180)))
>
> XPos(counter) = int(400 + Xchange(counter))
> Ypos(counter) = int(300 - Ychange(counter))
>
> q=q+60
>
> Next counter
>
> Is there any similar code for PTB?
>
> Alternatively, is there any easy way to calculate xy coordinates for each of these locations once the retina eccentricity is set?
>
> Thank you so much for your help.
>
>