JSDoc: Module: trajectory

# Module: trajectory

### Methods

#### (inner) distanceBetweenPoints(x_1, y_1, z_1, x_2, y_2, z_2) → {float}

Function to compute the distance between two three dimensional points.

This code is based on the function found in: http://snipplr.com/view.php?codeview&id=47207

##### Parameters:

Name | Type | Description
--- | --- | ---
`x_1` | float | Initial value of a position in the first dimension
`y_1` | float | Initial value of a position in the second dimension
`z_1` | float | Initial value of a position in the third dimension
`x_2` | float | Final value of a position in the first dimension
`y_2` | float | Final value of a position in the second dimension
`z_2` | float | Final value of a position in the third dimension

Source:
  - trajectory.js, line 244

##### Returns:

Value of the distance between the two points

Type
  float

#### (inner) getMinimumDelta(sampleData) → {float}

Function to calculate the minimum delta from an array of wrangled data by getSampleNamesAndDataForSortedTrajectories.

This function will not take into account as a minimum delta zero values i.e. the differential between two samples that lie at the same position in the gradient.

##### Parameters:

Name | Type | Description
--- | --- | ---
`sampleData` | Array.<Object> | An Array as computed from mapping file data and coordinates by getSampleNamesAndDataForSortedTrajectories.

Source:
  - trajectory.js, line 355

##### Throws:

Input data is undefined.

Type
  Error

##### Returns:

The minimum difference between two samples across the defined gradient.

Type
  float

#### (inner) getSampleNamesAndDataForSortedTrajectories(mappingFileHeaders, mappingFileData, coordinatesData, trajectoryCategory, gradientCategory) → {Array.<Object>}

Helper data wrangling function, takes as inputs a mapping file and the coordinates to synthesize the information into an array. Mainly used by the AnimationDirector object.

##### Parameters:

Name | Type | Description
--- | --- | ---
`mappingFileHeaders` | Array.<string> | The metadata mapping file headers.
`mappingFileData` | Array.<Array> | An Array where the indices are sample identifiers and each of the contained elements is an Array of strings where the first element corresponds to the first data for the first column in the mapping file (`mappingFileHeaders`).
`coordinatesData` | Array.<Object> | An Array of Objects where the indices are the sample identifiers and each of the objects has the following properties: x, y, z, name, color, P1, P2, P3, ... PN where N is the number of dimensions in this dataset.
`trajectoryCategory` | string | a string with the name of the mapping file header where the data that groups the samples is contained, this will usually be BODY_SITE, HOST_SUBJECT_ID, etc..
`gradientCategory` | string | a string with the name of the mapping file header where the data that spreads the samples over a gradient is contained, usually time or days_since_epoch. Note that this should be an all numeric category.

Source:
  - trajectory.js, line 275

##### Throws:

Any of the following:

- gradientIndex === -1
- trajectoryIndex === -1

Type
  Error

##### Returns:

An Array with the contained data indexed by the sample identifiers.

Type
  Array.<Object>

#### (inner) linearInterpolation(x_1, y_1, z_1, x_2, y_2, z_2, steps) → {Array.<Object>}

Function to interpolate a certain number of steps between two three dimensional points.

This code is based on the function found in: http://snipplr.com/view.php?codeview&id=47206

##### Parameters:

Name | Type | Description
--- | --- | ---
`x_1` | float | Initial value of a position in the first dimension
`y_1` | float | Initial value of a position in the second dimension
`z_1` | float | Initial value of a position in the third dimension
`x_2` | float | Final value of a position in the first dimension
`y_2` | float | Final value of a position in the second dimension
`z_2` | float | Final value of a position in the third dimension
`steps` | integer | Number of steps that we want the interpolation to run

Source:
  - trajectory.js, line 192

##### Returns:

Array of objects that have the x, y and z attributes

Type
  Array.<Object>