# Vector

A vector is a mathematical tool used to represent quantities that have both magnitude (size or value) and direction. Vectors are essential for describing and manipulating various aspects of a robot's motion and behavior. The blocks in this section allow you to create vector objects, manipulate these objects, and obtain information from these objects.

**length**

![](https://lh7-rt.googleusercontent.com/docsz/AD_4nXdjLKHhdtqslvSdbUqIBIZtQL8lv_I21GEGNV9HXBpv5dWPtAOixCetQvEsx5-okUGPS1-lElmPbd-SJLZHR4I7umV7jRIMoCQ_QCKOboTMaWW4Gqh82uzjGy31kd52tBkhsDB7Bd8lYiGeuRSrCKQlNaQ0?key=hRw9bBhBfp1lHBJ7rUAI2Q)

Returns the length of a given vector object.

**Magnitude**

![](https://lh7-rt.googleusercontent.com/docsz/AD_4nXd_a_Yt58w52UBnd-cRWApltF9dLZkp1qTlW_HwSYXMnGrsMEtP-N7Oqm-pcwhT72dxmykPxECY2NxobNGcay5CO-s9itSB4BbwlEI-Ir3oZCQpI-u1Zmwm3_zbFhdttYIm5DKVaDZTeda3qt0tJIO2VxA0?key=hRw9bBhBfp1lHBJ7rUAI2Q)

Returns the magnitude of a given vector object.  Magnitude represents the vector’s length or size, regardless of its direction. It's calculated using the Pythagorean theorem.

**get**

![](https://lh7-rt.googleusercontent.com/docsz/AD_4nXdswB1bHXF8N4acNtA6vn6cRu7gokuX0mrO-Zasrl9-KYJ0vO-nJRg5s-Xi8jpkCuXCtRfYRENyUmmjHIH0vxduNZIndQMLDb2eIGXSeq49U-D-f-HWQKYa3T0IlM4kokJtY_ccgLhwjUE69iqV8e6_DJe3?key=hRw9bBhBfp1lHBJ7rUAI2Q)

&#x20;Returns a particular of a given vector specified by the index value. Index starts from 0.

**put**

![](https://lh7-rt.googleusercontent.com/docsz/AD_4nXcEK95GtRxXyN3jgmpyxvL6xAnS4AanwfryC_GpUZTba6PRq8fEimwn24izESvfwOkHaWVmIbz6Uue4o4TrG8jLzDYYMs9VShByzFYwp8eJOcR5a2t4cXO4ehQtDJWnlP4E8mWwyHzJTXKy5K6E4ClrwdQ9?key=hRw9bBhBfp1lHBJ7rUAI2Q)

Update the given vector by updating the component specified by the index value and the given value. The other values in the vector are left intact.

**toText**

![](https://lh7-rt.googleusercontent.com/docsz/AD_4nXeKhbLh-nVyNFz4wJgJVtjqPeLW9BWyo9aPm_p5yzo1-qykli8jz4dgF-CNf8l37kTW0GzxVVhwLPMwAs012xzlsUKh1MbX0xnQf685fxIxbdwBKuwd6UqaTj8iUfbL29hJl9GXIRukbSGaOd45THER33M?key=hRw9bBhBfp1lHBJ7rUAI2Q)

Returns a text representation of the given vector object.

**normalized3D**

![](https://lh7-rt.googleusercontent.com/docsz/AD_4nXfOaxJ9lYnEQwn9XrsSnLbqzJ-K-2cvzfti_ZW5GZgdd8h0r1mm3s_GNQFT9m1Af5fFQ_zU6JESqmi60nOTRoWA1dgQ5KRKsMjzGLAP002HMPEIHDOavDvjLph5Fs_YkSpmDAHPklf4BDQm3HesnJap3ZlK?key=hRw9bBhBfp1lHBJ7rUAI2Q)

Given a vector that represents either a 3D coordinate or a 3D homogeneous coordinate, the function will return its normalized form. The result will always be a vector of length three, containing the coordinate values for x, y, and z at indices 0, 1, and 2, respectively.

**dotProduct**

![](https://lh7-rt.googleusercontent.com/docsz/AD_4nXdTlbOPSXzo4oZ1e-i99QPM4LfosoiYGLOCInwEt22HkVxhv5kK-FzcVMh4Np-jqFQ4U-6NOGiyoLi7XS7RcXP4PhC27qVHuJ8xlwEKCA0I92PxIFETXxnbIyy316xKdZRMNW4b4zq4tpLf4XPcXYyLyHg?key=hRw9bBhBfp1lHBJ7rUAI2Q)

Returns a number representing the dot product of vector1 and vector2. The two vectors must be of the same length. The dot product can be expressed as A · B = |A| |B| cos θ, where |A| and |B| are the magnitudes of vectors A and B, respectively and θ is the angle between the two vectors.

**added**

![](https://lh7-rt.googleusercontent.com/docsz/AD_4nXenjR6Jitl92QyApIeBebu1JaN__PiAZeOdlg2aXpF9JTEtG-O4M2YXtUR5t-Yc2HXY7Po-aOFqZspXJk_bno5dTNpWiSpOqF-7HbRPPlfjg3PLZfE6zzTf7lGppV2VLmFwaOp3H03F4Y4i3aT84SRpj30?key=hRw9bBhBfp1lHBJ7rUAI2Q)

Returns a new vector representing the result of adding vector1 and vector2. Vector1 and vector2’s values are not changed.

**add**

![](https://lh7-rt.googleusercontent.com/docsz/AD_4nXdvdae2PLF-DS_z3C0XpsMmwwtVDta7YgYAab4YDUA5tts0huA4H7TzRKLKuagAENpgjWE4m-5TJKACjnoz3nUgjqvIFR3ZfKI18nxIIhQiCcGrjHc1qN3XXNXBz0OsRRc_CP1oTQ-Ipwl-1guO3-eZ2Lo?key=hRw9bBhBfp1lHBJ7rUAI2Q)

Updates vector1 to be the sum of vector1 and vector2. vector2 is left intact.

**subtracted**

![](https://lh7-rt.googleusercontent.com/docsz/AD_4nXe9ANvtByjV3NSvBdwZRkBQNdVN9QF9HAWbevzcTQFd2h377q70fmW4xUsYT8VFR0pzMBlxD1XvtGOYZ1LvR6cVnb1HJDBOzMeWXySKRasfCpMS3TCanFHQnuVLR-ezSUFNdIBaPhjUc3cLYcl3c5nO_3E?key=hRw9bBhBfp1lHBJ7rUAI2Q)

Returns a new vector representing the result of subtracting vector2 from vector1. Vector1 and vector2’s values are not changed.

**subtract**

![](https://lh7-rt.googleusercontent.com/docsz/AD_4nXdYIYNloaFn1bteYNRZHOmdEy6l3eufiNk8GpFOb9eQoeCbculwItAD_SFYrqQly19Vb68Nu-_RwZ1_ruqiXKoGrZjzWbEU6Rdlb447rpNSCza3OJ1uWY-1b6vJ13LS7nTChM9zlASax7T5dMrx1FsYIb8?key=hRw9bBhBfp1lHBJ7rUAI2Q)

Updates vector1 to be vector1 subtracting vector2. vector2’s value doesn’t change.

**multiplied**

![](https://lh7-rt.googleusercontent.com/docsz/AD_4nXfhC0f3pRXzhqCAy2J9rftTFLocAqZG0x05gAgUEcRLcsuMrw3wGbRwv-vUojUQQTHw2wIrwQNl__D5BrRb8sR5Pf9AE1X86xMUe7ZXr7aCtp_jUSjxBySWQhuLtm7_8vioigj8JIwLh6IN8WcyvluGtNJw?key=hRw9bBhBfp1lHBJ7rUAI2Q)

Returns a new vector containing the elements of a given vector scaled by the given scale value.

**multiply**

![](https://lh7-rt.googleusercontent.com/docsz/AD_4nXfMj3dam0qJbYMp-8Ocj_p2e2VcYWE_2LF9kNcwFetYQv-l3hHUHYOMT0ZHpctOV2UPacrYbvoiogcdoiQaBskcBwrjXhSFt75T0bMPoY-dHa_A31BlRKuRu5vExwi0_6I1ihvHPaFVEOwZOrpTPrBzBrs8?key=hRw9bBhBfp1lHBJ7rUAI2Q)

Updates a given vector, with each value scaled by the given scale.

**new VectorF**

![](https://lh7-rt.googleusercontent.com/docsz/AD_4nXeVOne4MI1TSbD9YLZonhs9laW6k2LqdDDKsFRoB-3JLrQdiAj_7Tg0s353lQuWD4KUxtKHh2J7G9MbSvil-SnmE-mq2xQEXlDMLM4e0hH9mtP0nUV9_TjxKuG6noBqsbqeWc3JI3XZmxbtARh55Pmh0HGh?key=hRw9bBhBfp1lHBJ7rUAI2Q)

Creates a new vector of the given length. Each value is default to float 0.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://vrs-guidebook-2nd-edition.gitbook.io/vrs-guidebook-2nd-edition/programming/blocks/utilities/vector.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
