Non-visual shapes

TrajTracker provides a set of classes that define geometric shapes. These shapes are not visual: we can know their geometric properties and even assign them a location on screen, but they cannot be displayed.

These shapes can be used by trajtracker classes that require defining regions on screen - e.g., StartPoint.

Rectangle

class trajtracker.misc.nvshapes.Rectangle(size, position=(0, 0), rotation=0)
__init__(size, position=(0, 0), rotation=0)

Constructor - invoked when you create a new object by writing Rectangle()

Parameters:
  • size – the rectangle’s size (width, height)
  • position – the rectangle’s center (x, y)
  • rotation – Its rotation (0=straight; positive=clockwise)
static clone(rect)

Clone an existing rectangle :param rect: A rectangle object (can also be an Expyriment rectangle)

extend(extend_by)

Extend the rectangle by the given value

Parameters:extend_by – If a pair of values, the mean (w, h): extend the rectangle’s width by w and its height by h. If this is a single value, it is used for extending the width as well as the height.

Circle

class trajtracker.misc.nvshapes.Circle(x, y, radius)
__init__(x, y, radius)

Constructor - invoked when you create a new object by writing Circle()

Parameters:
  • x – the circle’s center
  • y – the circle’s center
  • radius

Sector

class trajtracker.misc.nvshapes.Sector(x, y, radius, from_angle, to_angle)

A sector of a circle

__init__(x, y, radius, from_angle, to_angle)

Constructor - invoked when you create a new object by writing Sector()

Parameters:
  • x – the circle’s center
  • y – the circle’s center
  • radius
  • from_angle – Left end of the sector (degrees)
  • to_angle – Right end of the sector (degrees)