expyriment.misc.geometry

The geometry module.

This module contains miscellaneous geometry functions for expyriment.

class expyriment.misc.geometry.XYPoint(x=None, y=None, xy=None)[source]

The Expyriment point class

Methods

distance(p)[source]

Return euclidian distance to the points (p).

Parameters :

p : misc.XYPoint

movement vector

Returns :

dist : float

distance to other point p

is_inside_polygon(point_list)[source]

Return true if point is inside a given polygon.

Parameters :

point_list : list

point list defining the polygon

Returns :

check : bool

move(v)[source]

Move the point along the coodinates specified by the vector v.

Parameters :

v : misc.XYPoint

movement vector

rotate(degree, rotation_centre=(0, 0))[source]

Rotate the point counterclockwise in degree around rotation_centre.

Parameters :

degree : int

degree of rotation (default=(0, 0) )

rotation_center : (numeric, numeric)

rotation center (x, y)

tuple[source]
x[source]

Getter for x

y[source]

Getter for y

expyriment.misc.geometry.coordinates2position(coordinate)[source]

Convert a coordinate on the screen to an expyriment position.

Parameters :

coordinate : (int, int)

coordinate (x,y) to convert

Returns :

coordinate : (int, int)

expyriment.misc.geometry.lines_intersect(pa, pb, pc, pd)[source]

Return true if two line segments are intersecting

Parameters :

pa : misc.XYPoint

point 1 of line 1

pb : misc.XYPoint

point 2 of line 1

pc : misc.XYPoint

point 1 of line 2

pb : misc.XYPoint

point 2 of line 2

Returns :

check : bool

True if lines intersect

expyriment.misc.geometry.points_to_vertices(points)[source]

Returns vertex representation of the points (int, int) in xy-coordinates

Parameters :

points : (int, int)

list of points

Returns :

vtx : list

list of vertices

expyriment.misc.geometry.position2coordinate(position)[source]

Convert an expyriment position to a coordinate on screen.

Parameters :

coordinate : (int, int)

coordinate (x,y) to convert

Returns :

coordinate : (int, int)

expyriment.misc.geometry.position2visual_angle(position, viewing_distance, monitor_size)[source]

Convert an expyriment position (pixel) to a visual angle from center.

Parameters :

position : (int, int)

position (x,y) to convert

viewing_distance : numeric

viewing distance in cm

monitior_size : numeric

physical size of the monitor in cm (x, y)

Returns :

angle : (float, float)

visual angle for x & y dimension

expyriment.misc.geometry.visual_angle2position(visual_angle, viewing_distance, monitor_size)[source]

Convert an position defined as visual angle from center to expyriment position (pixel).

Parameters :

visual_angle : (numeric, numeric)

position in visual angle (x,y) to convert

viewing_distance : numeric

viewing distance in cm

monitior_size : (numeric, numeric)

physical size of the monitor in cm (x, y)

Returns :

position : (float, float)

position (x,y)

Functions

expyriment.misc.geometry.coordinates2position(coordinate)[source]

Convert a coordinate on the screen to an expyriment position.

Parameters :

coordinate : (int, int)

coordinate (x,y) to convert

Returns :

coordinate : (int, int)

expyriment.misc.geometry.lines_intersect(pa, pb, pc, pd)[source]

Return true if two line segments are intersecting

Parameters :

pa : misc.XYPoint

point 1 of line 1

pb : misc.XYPoint

point 2 of line 1

pc : misc.XYPoint

point 1 of line 2

pb : misc.XYPoint

point 2 of line 2

Returns :

check : bool

True if lines intersect

expyriment.misc.geometry.points_to_vertices(points)[source]

Returns vertex representation of the points (int, int) in xy-coordinates

Parameters :

points : (int, int)

list of points

Returns :

vtx : list

list of vertices

expyriment.misc.geometry.position2coordinate(position)[source]

Convert an expyriment position to a coordinate on screen.

Parameters :

coordinate : (int, int)

coordinate (x,y) to convert

Returns :

coordinate : (int, int)

expyriment.misc.geometry.position2visual_angle(position, viewing_distance, monitor_size)[source]

Convert an expyriment position (pixel) to a visual angle from center.

Parameters :

position : (int, int)

position (x,y) to convert

viewing_distance : numeric

viewing distance in cm

monitior_size : numeric

physical size of the monitor in cm (x, y)

Returns :

angle : (float, float)

visual angle for x & y dimension

expyriment.misc.geometry.visual_angle2position(visual_angle, viewing_distance, monitor_size)[source]

Convert an position defined as visual angle from center to expyriment position (pixel).

Parameters :

visual_angle : (numeric, numeric)

position in visual angle (x,y) to convert

viewing_distance : numeric

viewing distance in cm

monitior_size : (numeric, numeric)

physical size of the monitor in cm (x, y)

Returns :

position : (float, float)

position (x,y)

Table Of Contents

Previous topic

expyriment.misc.extras.defaults

Next topic

expyriment.misc.geometry.XYPoint

This Page