intersections
intersections()
Calculates the intersections between multiple paths and creates one anchor per intersection point.
All resulting anchors will be named numerically, starting at 0. i.e., a call intersections("a", ...)
will generate the anchors "a.0"
, "a.1"
, "a.2"
to "a.n"
, depending of the number of intersections.
intersections("i", {
circle((0, 0))
bezier((0,0), (3,0), (1,-1), (2,1))
line((0,-1), (0,1))
rect((1.5,-1),(2.5,1))
})
for-each-anchor("i", (name) => {
circle("i." + name, radius: .1, fill: blue)
})
You can also use named elements:
circle((0,0), name: "a")
rect((0,0), (1,1), name: "b")
intersections("i", "a", "b")
for-each-anchor("i", (name) => {
circle("i." + name, radius: .1, fill: blue)
})
You can calculate intersections with hidden elements by using @@hide().
Name to prepend to the generated anchors. (Not to be confused with other name
arguments that allow the use of anchor coordinates.)