Repository navigation
How to plot tetrahedron inscribed in cube? #826
Replies: 2 comments
0 replies
#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))
line(d, c1, b)
line(c1, a1)
})
}) |
0 replies
Answer selected by
michaelfortunato
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment


Uh oh!
There was an error while loading. Please reload this page.
Hi, was wondering how to achieve this diagram in CeTZ?
Thanks
All reactions