Jollywatt/typst-fletcher

Default 3D coordinate system is left-handed?

KronosTheLate opened this issue · 2 comments

The following screenshot shows how a simple 3D coordinate system I made appears to be left-handed:
image

Code:
#import "@preview/cetz:0.2.0"  // Drawing diagrams directly in Document
#[
  #cetz.canvas(length: 2cm, {
  import cetz.draw: *
  rotate(y: 30deg)

  let grid_sidelength = 3
  grid(
    (-grid_sidelength/2, -grid_sidelength/2, -grid_sidelength/2), 
    (grid_sidelength/2, grid_sidelength/2, -grid_sidelength/2), 
    step: 0.5, stroke: gray + 0.2pt
  )

  line((-grid_sidelength/2, 0, 0), (grid_sidelength/2, 0, 0), name: "xaxis", mark: (end: "stealth"))
  content((name: "xaxis", anchor: 98%), [#v(1.5em)$ x $])
  line((0, -grid_sidelength/2, 0), (0, grid_sidelength/2, 0), name: "yaxis", mark: (end: "stealth"))
  content((name: "yaxis", anchor: 98%), [#h(-0.9em)$y$])
  line((0, 0, -grid_sidelength/2), (0, 0, grid_sidelength/2), name: "zaxis", mark: (end: "stealth"))
  content((name: "zaxis", anchor: 98%), [#h(-1em)$z$], anchor: "south-east")

  let ccol = red.darken(30%)
  line((0, 0, 0), (1, 0, 0), name: "ihat", mark:(end: "stealth", fill: ccol), stroke: ccol)
  content((name: "ihat", anchor: 65%, ), text(ccol)[#v(1.5em)$hat(i)$])

  let ccol = green.darken(30%)
  line((0, 0, 0), (0, 1, 0), name: "jhat", mark:(end: "stealth", fill: ccol), stroke: ccol)
  content((name: "jhat", anchor: 65%), text(ccol)[#h(-0.75em)$hat(j)$])

  let ccol = blue.darken(30%)
  line((0, 0, 0), (0, 0, 1), name: "khat", mark:(end: "stealth", fill: ccol), stroke: ccol)
  content((name: "khat", anchor: 65%), text(ccol)[#v(-1em)$hat(k)$])
})]
This seems like an odd choice to me. I tried changing `z-up` and `xy-up` in `set-style`, but I could not see any difference. Am I doing it wrong, or is the default coordinate system left-handed?

P.S: Awesome package. Easy to use, reaults look great.

Sorry, ment to raise this issue over at cetz itself. This is now done, so I will close this.

(Here's the cetz issue: cetz-package/cetz#501 for anyone reading)