Rotating a plane using Meshes.jl

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

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

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):

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"  
1 Like

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

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? :slight_smile: