Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const hexagon = []
for (let i = 0; i < 12; i++) { // -- shell like
const x = sin(i / 12 * 180) * 10
const y = cos(i / 12 * 180) * 10
shell.push(
translate([x, y, 0], scale(6 - i / 2, circle())) // { center: true }
)
}
const n = 6
for (let i = 0; i < n; i++) { // -- hexagon chain hulled
const x = sin(i / n * 360) * 10
const y = cos(i / n * 360) * 10
hexagon.push(
translate([x, y, 0], circle())// { center: true }
)
}
return [
translate([-20, 0, 0],
extrudeLinear({ height: 5 }, hullChain(shell))
),
hullChain(shell),
translate([20, 0, 0],
union(shell)
),
translate([-25, 40, 0],
extrudeLinear({ height: 5 }, hullChain({ closed: true }, hexagon))
),
translate([0, 40, 0],
const main = () => {
return [
extrudeRotate(translate([4, 0, 0], circle({ r: 1, segments: 30, center: true }))),
extrudeRotate({ segments: 5 },
translate([4, 0, 0], circle({ r: 1, segments: 30, center: true }))).translate([0, 10, 0]),
extrudeRotate({ segments: 30 },
translate([4, 0, 0], circle({ r: 1, segments: 5, center: true }))).translate([0, 20, 0]),
extrudeRotate({ segments: 4 }, translate([4, 0, 0], rectangle({ size: [1, 1], center: true })))
.translate([-10, 0, 0]),
extrudeRotate({ segments: 4 }, rectangle({ size: [1, 3], center: true }).translate([4, 0, 0]))
.translate([-20, 0, 0]),
extrudeRotate({ segments: 3 }, rectangle({ size: [2, 0.5], center: true }).translate([4, 0, 0]))
.translate([-20, 10, 0]),
extrudeRotate({ segments: 5 }, rectangle({ size: [1, 1], center: true }).translate([4, 0, 0]))
.translate([-20, 20, 0]),
extrudeRotate(polygon({ points: [[0, 0], [2, 1], [1, 2], [1, 3], [3, 4], [0, 5]] }))
.translate([10, 0, 0]),
extrudeRotate({ segments: 4 }, polygon({ points: [[0, 0], [2, 1], [1, 2], [1, 3], [3, 4], [0, 5]] }))
.translate([18, 0, 0])
]
}
const main = () => {
const base = circle({ radius: 4, segments: 4 })
let geometry3 = extrudeFromSlices(
{
numberOfSlices: 5,
callback: (progress, count, base) => {
let newshape = circle({ radius: 5 + count, segments: 4 + count })
let newslice = slice.fromSides(geom2.toSides(newshape))
newslice = slice.transform(mat4.fromTranslation([0, 0, count * 10]), newslice)
return newslice
}
}, base
)
let withHoles = geom2.create(
[
[[-10.0, 10.0], [-10.0, -10.0]],
[[-10.0, -10.0], [10.0, -10.0]],
callback: (progress, count, base) => {
let newshape = circle({ radius: 5 + count, segments: 4 + count })
let newslice = slice.fromSides(geom2.toSides(newshape))
newslice = slice.transform(mat4.fromTranslation([0, 0, count * 10]), newslice)
return newslice
}
}, base