#lang scheme
(require "../main.ss")
(require "../autocad.ss")
(define (table-top center radius sides height)
(do-extrude (make-polygon center radius sides)
height))
(define (table-feet base-c radius sides height tortion)
(define (draw-leg from to) (do-extrude (make-region (make-polygon from (/ height 10) sides))
from to))
(let ([high-points (polygon-points (+z base-c height) radius sides)]
[low-points (map (rotate-by z-axis tortion) (polygon-points base-c radius sides))])
(apply unite (map draw-leg low-points high-points))))
(define (table c radius sides height height-top-factor tortion)
(unite
(table-top (+z c (+ height (* height height-top-factor))) radius sides (* height height-top-factor))
(table-feet c (* radius 2/3) sides height tortion)))