Skip to content

Automatic adjustment of coordinates #678

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

You must be logged in to vote

I guess you want something dynamic like the following:

#import "@preview/cetz:0.2.2"
#set page(width: auto, height: auto)

#cetz.canvas({
  import cetz.draw: *

  set-style(circle: (radius: 0.8em))
  circle((0,0), name: "circ1")
  circle((2,2), name: "circ2")

  
  line("circ1",                             /* Intersection of a straight line between circ1.center and the next coordinate */
       ((), "-|", ("circ1", 50%, "circ2")), /* Move only horizontal to (circ1.x + circ2.x)/2 */
       ((), "|-", "circ2"),                 /* Move vertically to circ2.y */
       "circ2",                             /* Same as 1. but for circ2 */
      mark: (start: ">", fill: black))
})

With "circ2" at (…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by psads-git
Comment options

You must be logged in to vote
0 replies
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