Skip to content

How to plot tetrahedron inscribed in cube? #826

Closed Answered by orbitoo
michaelfortunato asked this question in Q&A
Discussion options

You must be logged in to vote
#import "@preview/cetz:0.4.0"

#set page(height: auto, width: auto, margin: (x: 10pt, y: 10pt))

#set text(5pt)
#cetz.canvas(length: 2cm, {
  import cetz.draw: *
  scale(z: 0.5)
  let a = (0, 0)
  let b = (1, 0)
  let c = (1, 1)
  let d = (0, 1)
  set-style(stroke: (thickness: 1pt, cap: "round"))
  line(b, c, d)
  let a1 = (-0.2, 0, 1)
  let b1 = (0.8, 0, 1)
  let c1 = (0.8, 1, 1)
  let d1 = (-0.2, 1, 1)
  line(a1, b1, c1, d1, close: true)
  line(b, b1)
  line(c, c1)
  line(d, d1)
  set-style(stroke: (dash: "dashed"))
  line(a, d)
  line(a, b)
  line(a, a1)
  on-layer(-1, {
    set-style(stroke: (thickness: 0.8pt, paint: red))
    line(a1, d, b, close: true)
    set-style(stroke: (dash: none

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by michaelfortunato
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants