# Rect

## visual Rect

Rectangular visual stimulus.

## Constructor

#### new Rect(options)

Source:
  - visual/Rect.js, line 18

##### Parameters:

Name | Type | Description
--- | --- | ---
`options` | Object | ###### Properties
Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`name` | String |  |  | the name used when logging messages from this stimulus
`win` | module:core.Window |  |  | the associated Window
`lineWidth` | number | <optional> | `1.5` | the line width
`lineColor` | Color | <optional> | `'white'` | the line color
`fillColor` | Color | <optional> |  | the fill color
`opacity` | number | <optional> | `1.0` | the opacity
`width` | number | <optional> | `0.5` | the width of the rectangle
`height` | number | <optional> | `0.5` | the height of the rectangle
`pos` | Array.<number> | <optional> | `[0, 0]` | the position
`size` | number | <optional> | `1.0` | the size
`ori` | number | <optional> | `0.0` | the orientation (in degrees)
`units` | string | <optional> | `"height"` | the units of the stimulus vertices, size and position
`contrast` | number | <optional> | `1.0` | the contrast
`depth` | number | <optional> | `0` | the depth
`interpolate` | boolean | <optional> | `true` | whether or not the shape is interpolated
`autoDraw` | boolean | <optional> | `false` | whether or not the stimulus should be automatically drawn on every frame flip
`autoLog` | boolean | <optional> | `false` | whether or not to log

### Extends

- ShapeStim

### Methods

#### (protected) _estimateBoundingBox()

Source:
  - visual/ShapeStim.js, line 184
Inherited From:
  - ShapeStim#_estimateBoundingBox

Estimate the bounding box.

#### (protected) _getPixiPolygon() → {Object}

Source:
  - visual/ShapeStim.js, line 268
Overrides:
  - ShapeStim#_getPixiPolygon

Get the PIXI polygon (in pixel units) corresponding to the vertices.

##### Returns:

the PIXI polygon corresponding to this stimulus vertices.

Type
  Object

#### (protected) _getVertices_px() → {Array.<Array.<number>>}

Source:
  - visual/ShapeStim.js, line 304
Overrides:
  - ShapeStim#_getVertices_px

Get the vertices in pixel units.

##### Returns:

the vertices (in pixel units)

Type
  Array.<Array.<number>>

#### (protected) _updateIfNeeded()

Source:
  - visual/ShapeStim.js, line 218
Overrides:
  - ShapeStim#_updateIfNeeded

Update the stimulus, if necessary.

#### (protected) _updateVertices()

Source:
  - visual/Rect.js, line 123

Update the vertices.

#### contains(object, units) → {boolean}

Source:
  - visual/ShapeStim.js, line 157
Inherited From:
  - ShapeStim#contains

Determine whether an object is inside the bounding box of the ShapeStim.

This is overridden in order to provide a finer inclusion test.

##### Parameters:

Name | Type | Description
--- | --- | ---
`object` | Object | the object
`units` | string | the units

##### Returns:

whether or not the object is inside the bounding box of the ShapeStim

Type
  boolean

#### setHeight(height, logopt)

Source:
  - visual/Rect.js, line 106

Setter for the height attribute.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`height` | number |  |  | the rectangle height
`log` | boolean | <optional> | `false` | whether of not to log

#### setVertices(vertices, logopt)

Source:
  - visual/ShapeStim.js, line 113
Overrides:
  - ShapeStim#setVertices

Setter for the vertices attribute.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`vertices` | Array.<Array.<number>> |  |  | the vertices
`log` | boolean | <optional> | `false` | whether of not to log

#### setWidth(width, logopt)

Source:
  - visual/Rect.js, line 88

Setter for the width attribute.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`width` | number |  |  | the rectangle width
`log` | boolean | <optional> | `false` | whether of not to log