Skip to content

Rotate inside group without shifting #246

Answered by johannes-wolf
JuliDi asked this question in Q&A
Discussion options

You must be logged in to vote

It is because the origin of the rotation is at (0,0) so you would have to translate everything first (you can use set-origin(()) and then use (0,0) as your circle position). BUT: It is way more easy not using rotation at all, but other anchors:

#import "@preview/cetz:0.1.2": canvas, draw, tree

#canvas(length: 1cm, {
  import draw: *
  line((0,0), (rel: (2, 0)))

  group({
    circle((), radius: 0.3, anchor: "left", name: "circle")
    line("circle.top-left", "circle.bottom-right")
    line("circle.top-right", "circle.bottom-left")
  })
})

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@JuliDi
Comment options

@johannes-wolf
Comment options

@JuliDi
Comment options

@johannes-wolf
Comment options

@JuliDi
Comment options

Answer selected by JuliDi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants