Unit Vector Function

Function to find a unit vector from an array of coordinates

This script returns a unit vector from an array that is input into the “Unit” function. If working with node objects and coordinates, one needs to put the coordinates into an array (shown in UnitVector_Example.js).

Function ‘Unit’ requires one input argument:
– array of coordinates determined by user-selected node
The functon returns the coordinates of the node and unit vector from the origin (0,0,0).

In this example, the user is prompted to select a node in the model. The coordinates of the node and unit vector from the origin (0,0,0) are subsequently displayed in the dialogue box.

Note, the origin point lies at centre of the circle. Radius of the circle is 100.