await visibility(), (() => {
const scene = new ln.Scene()
const a = new ln.Sphere(new ln.Vector(0, 0, 0), 1.1)
const s = .8
const b = new ln.Cube(new ln.Vector(-s, -s, -s), new ln.Vector(s, s, s))
b.paths = () => {
const paths = []
const { x: x1, y: y1, z: z1 } = b.min
const { x: x2, y: y2, z: z2 } = b.max
for(let i = 0; i <= 30; i++) {
const p = i / 30
const x = x1 + (x2 - x1) * p
const y = y1 + (y2 - y1) * p
paths.push([new ln.Vector(x, y1, z1), new ln.Vector(x, y1, z2)])
paths.push([new ln.Vector(x, y2, z1), new ln.Vector(x, y2, z2)])
paths.push([new ln.Vector(x1, y, z1), new ln.Vector(x1, y, z2)])
paths.push([new ln.Vector(x2, y, z1), new ln.Vector(x2, y, z2)])
paths.push([new ln.Vector(x2, y, z2), new ln.Vector(x1, y, z2)])
}
return paths
}
const c = new ln.Cylinder(0.6, -2, 2)
const d = new ln.TransformedShape(c, ln.rotate(new ln.Vector(1, 0, 0), Math.PI/2))
const e = new ln.TransformedShape(c, ln.rotate(new ln.Vector(0, 1, 0), Math.PI/2))
const result = new ln.BooleanShape(
ln.CSGOperation.Difference,
new ln.BooleanShape(
ln.CSGOperation.Difference,
new ln.BooleanShape(
ln.CSGOperation.Difference,
new ln.BooleanShape(ln.CSGOperation.Intersection, a, b),
c
),
d
),
e
)
scene.add(result)
const eye = new ln.Vector(1.1, 2.2, 1.2)
const center = new ln.Vector(0, 0, -0.2)
const up = new ln.Vector(0, 0, 1)
const height = 500
const fovy = 50
const znear = 0.1
const zfar = 10
const step = 0.01
const paths = scene.render(eye, center, up, width, height, fovy, znear, zfar, step)
return svg`${ln.toSVG(paths, width, height)}`
})()