# Makie: rotating HyperRectangles?

**URL:** <https://discourse.julialang.org/t/makie-rotating-hyperrectangles/17194>\
**Category:** Visualization\
**Tags:** question\
**Created:** [November 6, 2018, 12:17am UTC](https://discourse.julialang.org/t/makie-rotating-hyperrectangles/17194 "2018-11-06T00:17:18Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![kmhaeren](https://avatars.discourse-cdn.com/v4/letter/k/6de8d8/32.png) [@kmhaeren](https://discourse.julialang.org/u/kmhaeren)\
**Post date:** [November 6, 2018, 12:17am UTC](https://discourse.julialang.org/t/makie-rotating-hyperrectangles/17194/1 "2018-11-06T00:17:18Z")

</div>

Hi  
For my masters thesis I’m trying to write a very basic physics engine,  
and since Makie is the only package that seems to do graphics in Julia,  
I want to use it to handle the visualisation of simple moving objects in 3D (mainly hyperrectangles).  
Yet I can’t seem to find a way to do something simple as rotating a hyperrectangle,  
am I missing something? I’ve looked into using a mesh, but I was wondering if there isn’t a nicer way.  
Thanks in advance

---

<div class="post-metadata">

**Author:** ![sdanisch](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sdanisch/32/1406_2.png) [@sdanisch](https://discourse.julialang.org/u/sdanisch)\
**Post date:** [November 6, 2018, 9:34am UTC](https://discourse.julialang.org/t/makie-rotating-hyperrectangles/17194/2 "2018-11-06T09:34:07Z")

</div>

Fast batch drawing:

```plaintext
using Makie

N = 100

meshscatter(
  Point3f0.(rand.() .* 4, rand(N) .* 4, rand.() .* 0.01),
  markersize = Vec3f0.(rand.() .* 0.3, rand.() .* 0.3, rand(N)), 
  marker = FRect3D(Vec3f0(0), Vec3f0(1)),
  color = rand(RGBf0, N),
  rotations = Vec3f0.(rand(N) .* 0.3, rand.() .* 0.8, 1) # also accepts Quaternions
)

```

 ![image](https://global.discourse-cdn.com/julialang/original/3X/4/0/4035216696e241c8676ac9f323d7a35466639cc7.png)

```plaintext

using Makie
N = 100
scene = mesh(
  FRect3D(Vec3f0(-0.5), Vec3f0(1)), color = :skyblue2,
)
rect = scene[end] # last plot is the rect
# there are a couple of ratate! functions, that accept e.g. a vector etc
rotate!(rect, Quaternionf0(0, 0.4, 0, 1))
scene

```

 ![image](https://global.discourse-cdn.com/julialang/original/3X/b/b/bbea38796b81c9cdc97d59a0921fa39adee0af0b.jpeg)

If this works for you, you could consider adding this to the Makie examples so that the next person has an easier time 😉  
[https://github.com/JuliaPlots/Makie.jl/blob/master/examples/examples3d.jl#L599](https://github.com/JuliaPlots/Makie.jl/blob/master/examples/examples3d.jl#L599)

---

<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:** [November 7, 2018, 8:41pm UTC](https://discourse.julialang.org/t/makie-rotating-hyperrectangles/17194/3 "2018-11-07T20:41:33Z")

</div>

I get

```julia
scene = mesh(
         FRect3D(Vec3f0(-0.5), Vec3f0(1)), color = :skyblue2,
       )
Error showing value of type Scene:
ERROR: MethodError: no method matching _default(::Observables.Observable{GeometryTypes.HomogenousMesh{Point{3,Float32},GeometryTypes.Face{3,GeometryTypes.OffsetInteger{-1,UInt32}},GeometryTypes.Normal{3,Float32},Nothing,ColorTypes.RGBA{Float32},Nothing,Nothing}}, ::Makie.GLMakie.GLAbstraction.Style{:default}, ::Dict{Symbol,Any})
Closest candidates are:
  _default(::GeometryTypes.HomogenousMesh{Point{3,Float32},GeometryTypes.Face{3,GeometryTypes.OffsetInteger{-1,UInt32}},GeometryTypes.Normal{3,Float32},Nothing,ColorTypes.RGBA{Float32},Nothing,Nothing}, ::Makie.GLMakie.GLAbstraction.Style, ::Dict) at /Users/michael/.julia/dev/Makie/src/glbackend/GLVisualize/visualize/mesh.jl:49
  _default(::AxisArrays.AxisArray{T,3,D,Ax} where Ax where D, ::Makie.GLMakie.GLAbstraction.Style, ::Dict) where T at /Users/michael/.julia/dev/Makie/src/glbackend/GLVisualize/visualize/image_like.jl:138
  _default(::Union{Observable{T<:(AxisArray{T,2,D,Ax} where Ax where D where T)}, T<:(AxisArray{T,2,D,Ax} where Ax where D where T)}, ::Makie.GLMakie.GLAbstraction.Style, ::Dict) where T<:(AxisArrays.AxisArray{T,2,D,Ax} where Ax where D where T) at /Users/michael/.julia/dev/Makie/src/glbackend/GLVisualize/visualize/image_like.jl:154

```

on master with this

---

<div class="post-metadata">

**Author:** ![sdanisch](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sdanisch/32/1406_2.png) [@sdanisch](https://discourse.julialang.org/u/sdanisch)\
**Post date:** [November 7, 2018, 9:32pm UTC](https://discourse.julialang.org/t/makie-rotating-hyperrectangles/17194/4 "2018-11-07T21:32:31Z")

</div>

pfew, I guess I merged to much to master lately without tests, since I currently need to run them locally 😃 did you make sure, to synchronize AbstractPlotting & Makie on master?

---

<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:** [November 7, 2018, 10:09pm UTC](https://discourse.julialang.org/t/makie-rotating-hyperrectangles/17194/5 "2018-11-07T22:09:54Z")

</div>

Aaaahh! I got hit by the “`dev`ed packages aren’t touched” Pkg3 behaviour! It looks like you’re tracking master (if you don’t check the path of the package), but it’s your local master. `free` and `add #master` resolved this. Sorry for the noise.

---

<div class="post-metadata">

**Author:** ![kmhaeren](https://avatars.discourse-cdn.com/v4/letter/k/6de8d8/32.png) [@kmhaeren](https://discourse.julialang.org/u/kmhaeren)\
**Post date:** [November 8, 2018, 5:36pm UTC](https://discourse.julialang.org/t/makie-rotating-hyperrectangles/17194/6 "2018-11-08T17:36:21Z")

</div>

thank you so much!
