Curve line parameters

Hi,
I’m trying to create/present an arc in the builder (need it for staircase paradigm)
Couldn’t find how to control the convexity or, alternative, how to present slice of a circle.

I would appreciate some directing…
Adi

Hi Adi,

This advice comes with a disclaimer that I am a fairly novice psychopy user, and someone may know a better approach. But…

If you select yourself a polygon component, and then in the vertices box type 90, this will approximate a circle. Then to control the convexity, adjust the width and height options. At this point you will have a circle, a portion of which is hopefully the right shape for your arc. Then in the advanced settings clear the contents of the ‘fill’ box, to just leave you the outside line.
Next, make yourself another box using the polygon feature, but set this up so that it has the same fill as the background colour of your screen, and no line around it. Then position this using the x y co-ordinates box to block out the part of the circle you do not wish to see.

Not refined, but it might get the job done?

Christina

1 Like

Hi Christina,
I think that this could be a perfect solution for this situation.

thank you:)

Adi

Hi again,
So i tried this solution and it work fine.
However, due to the experiment paradigm (interleaved staircase), it is a bit complex to control both the size of the circle (my aim) and the location of the square (in order to create both concave and convex arcs).

Any other solutions for creating an arc in different radii? :confused:

thanks!
Adi

You could also generate a list of vertices for the polygon using code (some trigonometry) and set polygon.vertices to that value. Remember to set closeShape = False. I’m not sure that it’s simpler, but it’s more robust and flexible.

Something like this (untested):

center = (0, 0)  # position of the circle
angles = (30, 90)  # angles of the slice in degrees
r = 0.5  # radius, in whatever units the window uses
vertices = [(r*cos(np.deg2rad(angle))+center[0], r*sin(np.deg2rad(angle))+center[1]) for angle in range(angles[0], angles[1])]
polygon.vertices = vertices

Produces one point for each degree for code convenience. If you want to change the resolution, this is the range... part, perhaps using np.linspace.

Thanks! Sound good (and indeed more flexible)
i’ll try it.

Do you know if I can combine these parameters with the builder’s “interleave staircase” option (using Excel)?

Thanks again,
Adi

Hey there, How did lindeloev’s solution work for you in the end ?