# Mesh / GeometryBasics Rotate function

**URL:** <https://discourse.julialang.org/t/mesh-geometrybasics-rotate-function/44361>\
**Category:** Visualization\
**Created:** [August 5, 2020, 7:19pm UTC](https://discourse.julialang.org/t/mesh-geometrybasics-rotate-function/44361 "2020-08-05T19:19:50Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Allan\_Baker](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/allan_baker/32/42645_2.png) [@Allan\_Baker](https://discourse.julialang.org/u/Allan_Baker)\
**Post date:** [August 5, 2020, 7:19pm UTC](https://discourse.julialang.org/t/mesh-geometrybasics-rotate-function/44361/1 "2020-08-05T19:19:50Z")

</div>

I would have thought I could find this easier.  
I have loaded up and OBJ file with FileIO/MeshIO and am able to plot it in Makie with mesh.  
Is there a function already that will allow me to apply translations and rotations to the mesh as an object either by multiplying by a rotation matrix or a quaterion?

I would have thought this existed, but haven’t found it yet. About to make one for my purposes, but thought I would check.

Best Regards,  
Allan Baker

---

<div class="post-metadata">

**Author:** ![chakravala](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chakravala/32/6832_2.png) [@chakravala](https://discourse.julialang.org/u/chakravala)\
**Post date:** [August 5, 2020, 9:02pm UTC](https://discourse.julialang.org/t/mesh-geometrybasics-rotate-function/44361/2 "2020-08-05T21:02:21Z")

</div>

This is something you could try with [Grassmann.jl](https://github.com/chakravala/Grassmann.jl), where you can import a `GeometryBasics.Mesh` and manipulate it with the multivector generalization of quaternions (geometric algebra). It also specifically has `Makie` plotting compatibility for meshes. The design is still a work in progrees and not documented, but a mesh rotation feature would be interesting to do with it.

---

<div class="post-metadata">

**Author:** ![Allan\_Baker](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/allan_baker/32/42645_2.png) [@Allan\_Baker](https://discourse.julialang.org/u/Allan_Baker)\
**Post date:** [August 5, 2020, 10:29pm UTC](https://discourse.julialang.org/t/mesh-geometrybasics-rotate-function/44361/3 "2020-08-05T22:29:42Z")

</div>

I was able to implement one fairly easily with my home grown quarternion class’s rotate function it was fairly simple once I realized the “coordinates” function on the mesh object dumped an array of points that just needed to be rotated or translated and then the whole things is the first argument to the Mesh constructor with the “faces” function on the original function as the second argument. There may be a little more to catch attributes but I don’t think my mesh OBJ has any attributes.

---

<div class="post-metadata">

**Author:** ![mkborregaard](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkborregaard/32/556_2.png) [@mkborregaard](https://discourse.julialang.org/u/mkborregaard)\
**Post date:** [August 6, 2020, 6:35am UTC](https://discourse.julialang.org/t/mesh-geometrybasics-rotate-function/44361/4 "2020-08-06T06:35:57Z")

</div>

Makie offers a `rotate!` and a `translate!` function on a `Scene` that takes a quaternion. Does that not work?

---

<div class="post-metadata">

**Author:** ![Zach\_Christensen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/zach_christensen/32/7220_2.png) [@Zach\_Christensen](https://discourse.julialang.org/u/Zach_Christensen)\
**Post date:** [August 7, 2020, 12:03am UTC](https://discourse.julialang.org/t/mesh-geometrybasics-rotate-function/44361/5 "2020-08-07T00:03:56Z")

</div>

I think there was talk of more fully implementing CoordinateTransformations.jl at one point directly in GeometryBasics.jl. It would be pretty trivial to do.
