# Understand how we place the value

**URL:** <https://discourse.threejs.org/t/understand-how-we-place-the-value/84226>\
**Category:** Questions\
**Created:** [June 19, 2025, 5:34pm UTC](https://discourse.threejs.org/t/understand-how-we-place-the-value/84226 "2025-06-19T17:34:25Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![pat66](https://avatars.discourse-cdn.com/v4/letter/p/c2a13f/32.png) [@pat66](https://discourse.threejs.org/u/pat66)\
**Post date:** [June 19, 2025, 5:34pm UTC](https://discourse.threejs.org/t/understand-how-we-place-the-value/84226/1 "2025-06-19T17:34:25Z")

</div>

Hi everyone

I want understand the logic behind how we choice the value in this table ?

 ![float](https://canada1.discourse-cdn.com/flex035/uploads/threejs/original/3X/2/5/25c0955d9abface4318bdd68bf9b2e066888cd87.jpeg)

thanks

---

<div class="post-metadata">

**Author:** ![seanwasere](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/seanwasere/32/20864_2.png) [@seanwasere](https://discourse.threejs.org/u/seanwasere)\
**Post date:** [June 19, 2025, 6:51pm UTC](https://discourse.threejs.org/t/understand-how-we-place-the-value/84226/2 "2025-06-19T18:51:39Z")

</div>

`x,y,z,x,y,z,x,y,z`

Example,

> **[Modify a position attribute](https://editor.sbcode.net/55c8b53d554e3f8b33955da8b611d6292cf39818)**
>
> Modifying a position attribute of a THREE.BufferGeometry

---

<div class="post-metadata">

**Author:** ![prisoner849](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/prisoner849/32/535_2.png) [@prisoner849](https://discourse.threejs.org/u/prisoner849)\
**Post date:** [June 19, 2025, 9:06pm UTC](https://discourse.threejs.org/t/understand-how-we-place-the-value/84226/3 "2025-06-19T21:06:30Z")

</div>

Just a small node: you’ll see not that much with this data, as the triangle is degenerated (two vertices have the same coordinates (0, 1, 0) 🤔

---

<div class="post-metadata">

**Author:** ![hofk](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/hofk/32/44944_2.png) [@hofk](https://discourse.threejs.org/u/hofk)\
**Post date:** [June 20, 2025, 3:13pm UTC](https://discourse.threejs.org/t/understand-how-we-place-the-value/84226/4 "2025-06-20T15:13:11Z")

</div>

These two very simple examples show you the meaning of the values.

[BufferGeometryNonIndexed](https://hofk.de/main/discourse.threejs/2022/BufferGeometry/BufferGeometryNonIndexed.html)  
[BufferGeometryIndexed](https://hofk.de/main/discourse.threejs/2022/BufferGeometry/BufferGeometryIndexed.html)

rom the [Collection of examples from discourse.threejs.org](https://discourse.threejs.org/t/collection-of-examples-from-discourse-threejs-org/4315)

---

<div class="post-metadata">

**Author:** ![Fennec](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/fennec/32/59265_2.png) [@Fennec](https://discourse.threejs.org/u/Fennec)\
**Post date:** [June 20, 2025, 7:50pm UTC](https://discourse.threejs.org/t/understand-how-we-place-the-value/84226/5 "2025-06-20T19:50:23Z")

</div>

I like to use the built-in `three.js` math classes to read from and write to typed arrays.

`THREE.Vector2` for an `itemSize` of 2  
`THREE.Vector3` for an `itemSize` of 3  
`THREE.Vector4` for an `itemSize` of 4  
`THREE.Color` for colors, `THREE.Euler` and `THREE.Quaternion` for rotation.

```js
const _vec3 = new THREE.Vector3();

const array = new FLoat32Array([
   0,1,0,
   0,1,0,
   0,1,1
])

// Read item 0 from the array
let offset = 0;
_vec3.fromArray(array, offset);

// Update the vector (e.g. scale it)
_vec3.multiplyScalar(2);

// Write it back to the array
_vec3.toArray(array, offset);

console.log(array);
// Output: [0, 2, 0, 0, 1, 0, 0, 1, 1]

```

Or in a loop

```js
const itemSize = 3; // for Vector3
for (let i = 0; i < array.length; i += itemSize) {
	_vec3
		.fromArray(array, i); // Read
	    .multiplyScalar(2); // Update
	    //... other operations
	    .toArray(array, i); // Write
}

console.log(array);
// Output: [0, 2, 0, 0, 2, 0, 0, 2, 2]

```
