# Tetrahedron rotation by points

**URL:** <https://discourse.threejs.org/t/tetrahedron-rotation-by-points/28677>\
**Category:** Questions\
**Tags:** transform\
**Created:** [August 5, 2021, 2:49pm UTC](https://discourse.threejs.org/t/tetrahedron-rotation-by-points/28677 "2021-08-05T14:49:16Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![kirill321592](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/kirill321592/32/20381_2.png) [@kirill321592](https://discourse.threejs.org/u/kirill321592)\
**Post date:** [August 5, 2021, 2:49pm UTC](https://discourse.threejs.org/t/tetrahedron-rotation-by-points/28677/1 "2021-08-05T14:49:17Z")

</div>

I am drawing a tetrahedron by coordinates. I have 4 vertex coord. I’m trying to get the right rotation from these points. I tried unsuccessfully with

```javascript
const edge = points[0].distanceTo(points[2]);
const plane = new THREE.Plane();
const point = getPointInBetweenByLen(points[0], points[2], edge / 2);
plane.setFromCoplanarPoints(point, points[1], points[3]);
mesh.lookAt(plane.normal);

```

![Capture](https://canada1.discourse-cdn.com/flex035/uploads/threejs/original/3X/f/8/f83f02d5e572991ab8e4af34a4a6d09fadbbdf4c.png)  
[[http://jsfiddle.net/kirill321592/Lg91v2xd/42/](http://jsfiddle.net/kirill321592/Lg91v2xd/42/)](full code here)

---

<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:** [August 5, 2021, 4:33pm UTC](https://discourse.threejs.org/t/tetrahedron-rotation-by-points/28677/2 "2021-08-05T16:33:35Z")

</div>

Hi!

> [@kirill321592](#):
>
> to get the right rotation from these points

What do you mean with this? Any explanatory picture of the desired result?

---

<div class="post-metadata">

**Author:** ![kirill321592](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/kirill321592/32/20381_2.png) [@kirill321592](https://discourse.threejs.org/u/kirill321592)\
**Post date:** [August 5, 2021, 4:44pm UTC](https://discourse.threejs.org/t/tetrahedron-rotation-by-points/28677/3 "2021-08-05T16:44:10Z")

</div>

The vertices of the shape should be on points, these will be dynamic coordinates from xml, just like you helped me with the cone, only now there are 4 points

---

<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:** [August 5, 2021, 5:12pm UTC](https://discourse.threejs.org/t/tetrahedron-rotation-by-points/28677/4 "2021-08-05T17:12:41Z")

</div>

Is it not an option to build a tetrahedron, having these 4 points?  
An example: [Tetrahedron (non-indexed buffer geometry)](https://discourse.threejs.org/t/tetrahedron-non-indexed-buffer-geometry/12542)

---

<div class="post-metadata">

**Author:** ![kirill321592](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/kirill321592/32/20381_2.png) [@kirill321592](https://discourse.threejs.org/u/kirill321592)\
**Post date:** [August 5, 2021, 6:24pm UTC](https://discourse.threejs.org/t/tetrahedron-rotation-by-points/28677/5 "2021-08-05T18:24:29Z")

</div>

Thanks, you best. Maybe you have some resource where I can read more about BufferGeometry besides the official documentation?

---

<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:** [August 5, 2021, 6:27pm UTC](https://discourse.threejs.org/t/tetrahedron-rotation-by-points/28677/6 "2021-08-05T18:27:55Z")

</div>

As an option: [Three.js Custom BufferGeometry](https://threejsfundamentals.org/threejs/lessons/threejs-custom-buffergeometry.html)
