/
getDistance

getDistance

Description

Measures the distance between two nodes in a scene.

The default behavior (no flags used) returns the distance at the current frame. The -avg, -min, -max, -range, and -sd flags all return a value that's based on a number of frames. That number of frames is the play range by default unless the -rangesOnly option is used.

Functional area

Data retrieval

Command syntax

Syntax

getDistance node1 node2 [-avg] [-min] [-max] [-range] [-sd] [-rangesOnly] [-mustHaveKeys]

Arguments

NameTypeRequiredComments
node1stringyesNode to measure from
node2stringyesNode to measure to

Flags

NameFlag argumentsArgument typeExclusive toComments
-avg0-min, -max, -range, -sdReturns the average distance
-min0-avg, -max, -range, -sdReturns the minimum distance
-max0-avg, -min, -range, -sdReturns the maximum distance
-range0-avg, -min, -max, -sdReturns the difference of the min and max
-sd0-avg, -min, -max, -rangeReturns the standard deviation
-rangesOnly0Computes distance calculations over the selected time ranges only
-mustHaveKeys0Only computes distance on frames where both nodes have a key present

Return value

float

Returns the distance in mm from node1 to node2

Examples

// create a clip
create Clip Clip_1;
 
// create two objects which we want to compute distances between 
create Marker Marker_1;
create Bone Bone_1;
 
// move the bone 300 and 400 in x, y (respectively
setKey "Translation.X" 300 -onMod Bone_1;
setKey "Translation.Y" 400 -onMod Bone_1;
 
// show that the bone is 500 mm away from the marker as expected
print(getDistance("Marker_1", "Bone_1"));

Additional information

Related commands


© Copyright Vicon Motion Systems. All rights reserved.

Vicon trademarks