---
title: "getLength"
canonical: "https://help.vicon.com/space/ShogunPost121/1253737337/getLength"
format: markdown
---
# Description

Use getLength when you need to obtain the length of a vector.

Given the position of an object in a variable of type vector, getLength returns the distance from that object to the origin.

Use [getDistance](https://vicon-help.atlassian.net/wiki/spaces/ShogunPost121/pages/1253736900) when you need to obtain the distance between two points specified as variables of type vector.

## Functional area

Math

# Command syntax

## Syntax

> Macro (scroll-tablelayout)

|  |
| --- |
| `getLength vector` |

### Arguments

| Name | Type | Required | Comments |
| --- | --- | --- | --- |
| `vector` | vector | yes | Vector variable |

### Flags

None

## Return value

float

Returns a floating point value which is the length of the input vector v 

> Macro (scroll-pagebreak)

## Examples

```plaintext
// In this procedure, a vector variable is declared and getLength is 
// used to return its length.
// The command returns a float value of: 5 (3-4-5 right triangle)
vector $v1 = <<3, 4, 0>>;
float $length = getLength($v1);
print( $length );
```

# Additional information

## Related commands

- [getDistance](https://vicon-help.atlassian.net/wiki/spaces/ShogunPost121/pages/1253736900)
- [setLength](https://vicon-help.atlassian.net/wiki/spaces/ShogunPost121/pages/1253736736)