cetz-package / cetz

CeTZ: ein Typst Zeichenpaket - A library for drawing stuff with Typst.
https://cetz-package.github.io
GNU Lesser General Public License v3.0
828 stars 35 forks source link

Drawing a simple cube #534

Closed heinrichti closed 5 months ago

heinrichti commented 6 months ago

When trying to draw a simple cube the edges seem to be to not match at all. I tried different approaches, but I just can't seem to get the edges to connect properly. Here is a simple example with a line:

#import "@preview/cetz:0.2.2"

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

  line((0,0), (1,0), (1,1), (1,1,0.2), (1,0,0.2), (1,0), (0,0), (0,1), (1,1), (1,1,0.2), (0,1,0.2), (0,1))
})

Here is a screenshot of the output. Notice the edges on the top right in particular, but also on the bottom right and top left.

Screenshot 2024-03-20 223400

fenjalien commented 6 months ago

You could try changing the stroke styling, specifically join (https://typst.app/docs/reference/visualize/stroke/#constructor-join) or miter-limit (https://typst.app/docs/reference/visualize/stroke/#constructor-miter-limit). With set-style(stroke: (join: "bevel")): image