Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Predictable intersections discovery #667

Open
psads-git opened this issue Aug 6, 2024 Discussed in #665 · 1 comment
Open

Predictable intersections discovery #667

psads-git opened this issue Aug 6, 2024 Discussed in #665 · 1 comment
Milestone

Comments

@psads-git
Copy link

Discussed in #665

Originally posted by psads-git August 5, 2024
The following code produces the figure below. I was able to find out the labels for the intersections anchors only by trial and error. Is there some way of getting the labels of those intersections by using a systematic and deterministic way (and not by trial and error)? Thanks!

#import "@preview/cetz:0.2.2"

#cetz.canvas({
  import cetz.draw: *
 
  intersections("i", {
    circle((-3,0), radius: 0.5)
    circle((rel: (6,0)), radius: 0.5)
    circle((rel: (-3,3)), radius: 0.5)
    circle((rel: (0,-6)), radius: 0.5)
    hide(circle((0,0), radius: 3))
  })

  arc-through("i.0", (135deg, 3) , "i.5")
  arc-through("i.4", (45deg, 3) , "i.3") 
  arc-through("i.6", (-45deg, 3) , "i.2")
  arc-through("i.1", (-135deg, 3) , "i.7")

  for-each-anchor("i", (name) => {
    circle("i." + name, radius: 0.1, fill: red, stroke: red)
  })
})

image

@psads-git
Copy link
Author

psads-git commented Aug 6, 2024

A solution proposed by @fenjalien is the following:

if you use for-each-anchor and display the anchor's name at its position it should tell you easily enough.

While the suggested workaround is a nice solution when dealing with a modest number of circles, it could become cumbersome if the number of circles is very large. It might be advisable to consider introducing some form of anchor sorting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants