You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was looking for an easy way to draw right angles and couldn't find a built-in solution in CeTZ, so I wrote the following:
let angle-point-to-point(a, b) = {
return calc.atan2(b.at(0) - a.at(0), b.at(1) - a.at(1))
}
let right-angle(origin, a, b, radius: 5pt, ..style) = {
get-ctx(ctx => {
let a = cetz.coordinate.resolve(ctx, a)
let b = cetz.coordinate.resolve(ctx, b)
let angle-a = angle-point-to-point(origin, a)
let angle-b = angle-point-to-point(origin, b)
line((origin, radius, a), (rel: (angle-b, radius)), ..style)
line((origin, radius, b), (rel: (angle-a, radius)), ..style)
})
}
And used it like this: right-angle(O, A, B, radius: 10pt, stroke: green) to produce:
It seems to work OK but I was wondering if drawing right angles can or will be built into CeTZ.
The text was updated successfully, but these errors were encountered:
I was looking for an easy way to draw right angles and couldn't find a built-in solution in CeTZ, so I wrote the following:
And used it like this:
right-angle(O, A, B, radius: 10pt, stroke: green)
to produce:It seems to work OK but I was wondering if drawing right angles can or will be built into CeTZ.
The text was updated successfully, but these errors were encountered: