Skip to content

Commit

Permalink
arc: Set previous point to arc end
Browse files Browse the repository at this point in the history
  • Loading branch information
johannes-wolf committed Dec 3, 2023
1 parent 40477d2 commit 74e2a3f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/draw/shapes.typ
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,10 @@
z
)

// center is calculated based on observations of tikz's circular sector and semi circle shapes.
// Set the last position to arc-end
ctx.prev.pt = arc-end

// Center is calculated based on observations of tikz's circular sector and semi circle shapes.
let center = if style.mode != "CLOSE" {
// A circular sector's center anchor is placed half way between the sector-center and arc-center when the angle is 180deg. At 60deg it is placed 1/3 of the way between, this is mirrored at 300deg.
vector.lerp(
Expand Down
Binary file added tests/arc/last-pos/ref.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions tests/arc/last-pos/test.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#set page(width: auto, height: auto)
#import "/src/lib.typ": *

#box(stroke: 2pt + red, canvas({
import draw: *

arc((0,0), start: 0deg, stop: 180deg)
circle((), radius: .1, fill: blue)
}))

#box(stroke: 2pt + red, canvas({
import draw: *

arc((0,0), start: 180deg, stop: 0deg)
circle((), radius: .1, fill: blue)
}))

0 comments on commit 74e2a3f

Please sign in to comment.