# Rotating a plane using Meshes.jl

**URL:** <https://discourse.julialang.org/t/rotating-a-plane-using-meshes-jl/100795>\
**Category:** General Usage\
**Created:** [June 24, 2023, 10:12pm UTC](https://discourse.julialang.org/t/rotating-a-plane-using-meshes-jl/100795 "2023-06-24T22:12:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ahmed\_Salih](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ahmed_salih/32/206579_2.png) [@Ahmed\_Salih](https://discourse.julialang.org/u/Ahmed_Salih)\
**Post date:** [June 24, 2023, 10:12pm UTC](https://discourse.julialang.org/t/rotating-a-plane-using-meshes-jl/100795/1 "2023-06-24T22:12:30Z")

</div>

In Meshes.jl, if I define a plane such as:

```julia
using Meshes

BP = Plane((0,0,0),(0,0,1))

```

In which (0,0,1) is the normal vector of the plane. How would I apply a rotation to the plane, such that the normal vector would be (1,0,0)?

I.e. how do I rotate the “Plane”?

Kind regards

---

<div class="post-metadata">

**Author:** ![empet](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/empet/32/221303_2.png) [@empet](https://discourse.julialang.org/u/empet)\
**Post date:** [June 26, 2023, 9:21am UTC](https://discourse.julialang.org/t/rotating-a-plane-using-meshes-jl/100795/2 "2023-06-26T09:21:01Z")

</div>

In your case the plane rotates about Y axis. Hence importing `Rotations.jl` and rotating the normal about yaxis, you can define a new plane from the origin and the new normal. If you want to rotate progresively from the normal `n₀=Vec(0.0,0.0,1.0)` to the normal `nₜ =Vec(1.0, 0.0, 0.0), t=π/2`, then this code should work (I have not installed Meshes.jl):

```julia
using Meshes, Rotations
O = Point(0.0, 0.0, 0.0)
n₀ = Vec(0.0, 0.0, 1.0)
θ=range(0, π/2, 10)
for t ∈ θ
  pₜ=Plane(O, RotY(t)*n₀)
  "do something with the new plane"  
end 

```

---

<div class="post-metadata">

**Author:** ![juliohm](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/juliohm/32/215266_2.png) [@juliohm](https://discourse.julialang.org/u/juliohm)\
**Post date:** [June 26, 2023, 11:26am UTC](https://discourse.julialang.org/t/rotating-a-plane-using-meshes-jl/100795/3 "2023-06-26T11:26:34Z")

</div>

We provide the `Rotate` transform in Meshes.jl that uses the Rotations.jl package behind the scenes:

[https://juliageometry.github.io/Meshes.jl/stable/transforms.html](https://juliageometry.github.io/Meshes.jl/stable/transforms.html)

It would be nice to add a method to rotate `Plane` specifically that simply returns another plane object as an optimization. Would you like to submit a PR? 🙂
