psychopy.visual.helpers.
pointInPolygon
(x, y, poly)¶Determine if a point is inside a polygon; returns True if inside.
(x, y) is the point to test. poly is a list of 3 or more vertices as (x,y) pairs. If given an object, such as a ShapeStim, will try to use its vertices and position as the polygon.
Same as the .contains() method elsewhere.
psychopy.visual.helpers.
polygonsOverlap
(poly1, poly2)¶Determine if two polygons intersect; can fail for very pointy polygons.
Accepts two polygons, as lists of vertices (x,y) pairs. If given an object with with (vertices + pos), will try to use that as the polygon.
Checks if any vertex of one polygon is inside the other polygon. Same as the .overlaps() method elsewhere.
psychopy.visual.helpers.
groupFlipVert
(flipList, yReflect=0)¶Reverses the vertical mirroring of all items in list flipList
.
Reverses the .flipVert status, vertical (y) positions, and angular
rotation (.ori). Flipping preserves the relations among the group’s
visual elements. The parameter yReflect
is the y-value of an
imaginary horizontal line around which to reflect the items;
default = 0 (screen center).
Typical usage is to call once prior to any display; call again to un-flip. Can be called with a list of all stim to be presented in a given routine.
Will flip a) all psychopy.visual.xyzStim that have a setFlipVert method, b) the y values of .vertices, and c) items in n x 2 lists that are mutable (i.e., list, numpy.array, no tuples): [[x1, y1], [x2, y2], ...]