muse/book-reading-clip-lamp

A Wi‑Fi/USB‑C ESP32‑S3 reading lamp with OV5640 camera, microphone, speaker amplifier, rechargeable Li‑Po power management, six-LED boost light, USB protection/charging detection, and a clip/gooseneck enclosure with external FlexPIFA antenna.

Version
0.4.3
License
unset
Stars
0

mechanical-primitives.ts

/** Shared serializable JSCAD operations; dimensions in millimetres. */
export type Plan = Record<string, any>
export type V3 = [number, number, number]
export const move = (vector: V3, shape: Plan): Plan => ({ type: "translate", vector, shape })
export const turn = (angles: V3, shape: Plan): Plan => ({ type: "rotate", angles, shape })
export const union = (...shapes: Plan[]): Plan => ({ type: "union", shapes })
export const subtract = (shape: Plan, ...cuts: Plan[]): Plan => ({ type: "subtract", shapes: [shape, ...cuts] })
export const tint = (color: V3, shape: Plan): Plan => ({ type: "colorize", color, shape })
export const box = (size: V3, center: V3 = [0, 0, 0]): Plan => move(center, { type: "cuboid", size })
export const cyl = (radius: number, z0: number, z1: number, x = 0, y = 0): Plan =>
  move([x, y, (z0 + z1) / 2], { type: "cylinder", radius, height: z1 - z0, segments: 96 })