### time-hulls

`0.0.106`
Need help reading this?

### TimeHullSeries

A TimeHullSeries is an object that calculates a series of TimeHulls

new TimeHullSeries(opt: Object)
Parameters
opt `(Object)` An options object

Name | Description
--- | ---
opt.points `Array` | Array of points. Points should include `timestamp` , `x` , and `y` properties. E.g. `[{ timestamp: 0, x: 532, y: 354 }, { timestamp: 100, x: 432, y: 754 }]`
opt.period `Number` | The duration (milliseconds) over which convex hulls are computed. All `TimeHull` durations will be less than or equal to `TimeHullSeries.period` .
opt.timestep `Number` (default `0`) | The minimum amount of time required (milliseconds) between the `endTime()` of the last computed `TimeHull` and the `endTime()` of the next computed `TimeHull` .
opt.includeIncomplete `Boolean` (default `false`) | Set to `true` to include the initial convex hulls that are less than `TimeHullSeries.period` .
opt.width `Number` (default `0`) | The width (px) of the area that the points were recorded in. This is not necessarily the width of a stimulus image, but it often is.
opt.height `Number` (default `0`) | The height (px) of the area that the points were recorded in. This is not necessarily the height of a stimulus image, but it often is.

Instance Members
▸ getCoverageDurations()
getCoverageDurations()
▸ getAverageCoverage()

Gets the `coverage()` of the `TimeHulls`, averaged by each `TimeHull's` `duration`.

getAverageCoverage(): Number
Returns
`Number`: Proportion `[0:1]` . `0` means that no `TimeHull's` had any `coverage` , while `1` means that all of the `TimeHull's` in the `TimeHullSeries` had 100% `coverage` .
▸ getFinalCoverage()
getFinalCoverage()
▸ getCentroidDistances(opt)
getCentroidDistances(opt: Object): Array
Parameters
opt `(Object)`
Returns
`Array`:
▸ getAverageCentroidVelocity(opt)
getAverageCentroidVelocity(opt: Object): Array
Parameters
opt `(Object)`
Returns
`Array`:
▸ getAverageVelocity(opt)

[getAverageVelocity description]

getAverageVelocity(opt: Object): Number
Parameters
opt `(Object)`
Returns
`Number`: [description]
▸ getCentroids(opt)

Gets the `centroid` of each `TimeHull` in the `TimeHullSeries`

getCentroids(opt: Object): Array
Parameters
opt `(Object = `{}`)` An options object

Name | Description
--- | ---
opt.hull `TimeHull?` | The last `hull` to calculate a centroid for.
opt.hullIndex `Number?` | The index of the last `hull` to calculate a centroid for.
opt.which `String?` | The name of the property to return from each centroid. E.g. `'x'` .

Returns
`Array`: The `centroid` of each `TimeHull` in the `TimeHullSeries` . If `hull` or `hullIndex` are provided then truncate the array at the specified `hull` . If `which` is provided then map only that property.
▸ getDuration()

[getDuration description]

getDuration(): Number
Returns
`Number`: [description]
▸ getHullDurations()

[getHullDuration description]

getHullDurations(): Number
Returns
`Number`: [description]
▸ getEndPointIndex(startIndex)

[getEndPointIndex description]

getEndPointIndex(startIndex: Number): Number
Parameters
startIndex `(Number)` [description]
Returns
`Number`: [description]
▸ getEndTime()
getEndTime(): Number
Returns
`Number`: The timestamp of the last point in the TimeHullSeries
▸ getHull(opt)

[getHull description]

getHull(opt: Object): TimeHull
Parameters
opt `(Object = `{}`)` An options object

Name | Description
--- | ---
opt.hull `TimeHull?` | The last `hull` to calculate a centroid for.
opt.hullIndex `Number?` | The index of the last `hull` to calculate a centroid for.

Returns
`TimeHull`: [description]
▸ getHulls()

[getHulls description]

getHulls(): Array
Returns
`Array`: An array of `TimeHull` objects
▸ getStartPointIndex(endIndex)

[getStartPointIndex description]

getStartPointIndex(endIndex: Number): Number
Parameters
endIndex `(Number)` [description]
Returns
`Number`: [description]
▸ getStartTime()
getStartTime(): Number
Returns
`Number`: The timestamp of the first point in the TimeHullSeries

### TimeHull

[TimeHull description]

new TimeHull(opt: Object)
Parameters
opt `(Object)` An options object

Name | Description
--- | ---
opt.seriesPoints `Array` | All points in the `TimeHullSeries`
opt.startIndex `Number` (default `0`) | [description]
opt.endIndex `Number` (default `opt.seriesPoints.length-1`) | [description]
opt.width `Number` (default `0`) | [description]
opt.height `Number` (default `0`) | [description]

Static Members
▸ coordinatesToXY(points)

[coordinatesToXY description]

coordinatesToXY(points: Array): Array
Parameters
points `(Array)` [description]
Returns
`Array`: [description]
▸ getDistinctPoints(points)

[getDistinctPoints description]

getDistinctPoints(points: Array): Array
Parameters
points `(Array)` [description]
Returns
`Array`: [description]
▸ XYToCoordinates(points)

[XYToCoordinates description]

XYToCoordinates(points: Array): Array
Parameters
points `(Array)` [description]
Returns
`Array`: [description]
Instance Members
▸ getArea(opt)

[area description]

getArea(opt: Object): Number
Parameters
opt `(Object)` An options object

Name | Description
--- | ---
opt.points `Array` (default `this.points`) | [description]

Returns
`Number`: [description]
▸ azimuth()

[azimuth description]

azimuth(): Number
Returns
`Number`: [description]
▸ calculateCentroid(points)

[calculateCentroid description]

calculateCentroid(points: Array): Object
Parameters
points `(Array)` [description]
Returns
`Object`: The centroid of `points` `{ x: Number, y: Number }`
▸ getCentroid(opt)

[getCentroid description]

getCentroid(opt: Object): Object
Parameters
opt `(Object = `{}`)` [description]

Name | Description
--- | ---
opt.points `Array` (default `this.points`) | [description]
opt.which `String?` | [description]

Returns
`Object`: [description]
▸ getCoverage(opt)

[getCoverage description]

getCoverage(opt: Object): Number
Parameters
opt `(Object = `{}`)` An options object

Name | Description
--- | ---
opt.points `Array` (default `this.points`) | [description]
opt.width `Number?` | [description]
opt.height `Number?` | [description]

Returns
`Number`: [description]
▸ coverageDuration(opt)

[coverageDuration description]

coverageDuration(opt: Object): Number
Parameters
opt `(Object)` [description]
Returns
`Number`: [description]
▸ coveragePercent(opt)

[coveragePercent description]

coveragePercent(opt: Object): Number
Parameters
opt `(Object = `{}`)` [description]

Name | Description
--- | ---
opt.points `Array` (default `this.points`) | [description]

Returns
`Number`: [description]
▸ distance(which?)

[distance description]

distance(which: String?): Number
Parameters
which `(String?)` [description]
Returns
`Number`: [description]
▸ elapsedTime()

[elapsedTime description]

elapsedTime(): Number
Returns
`Number`: [description]
▸ endTime()

[endTime description]

endTime(): Number
Returns
`Number`: [description]
▸ getPoints(which?)

[getPoints description]

getPoints(which: String?): Array
Parameters
which `(String?)` [description]
Returns
`Array`: [description]
▸ getSlicedPoints(which?)

[getSlicedPoints description]

getSlicedPoints(which: String?): Array
Parameters
which `(String?)` [description]
Returns
`Array`: [description]
▸ lastPoint()

[lastPoint description]

lastPoint(): Object
Returns
`Object`: [description]
▸ period()

[period description]

period(): Number
Returns
`Number`: [description]
▸ getPolygon(opt)

[polygon description]

getPolygon(opt: Object): Array
Parameters
opt `(Object = `{}`)` [description]

Name | Description
--- | ---
opt.points `Array` (default `this.points`) | [description]
opt.which `String?` | [description]

Returns
`Array`: [description]
▸ startTime()

[startTime description]

startTime(): Number
Returns
`Number`: [description]
▸ timestep()

[timestep description]

timestep(): Number
Returns
`Number`: [description]
▸ velocity(which?)

[velocity description]

velocity(which: String?): Number
Parameters
which `(String?)` [description]
Returns
`Number`: [description]