KP3Dii/Data/resources/scripts/build-cylinder.scm

18 lines
643 B
Scheme
Raw Normal View History

; Routine to build a circle/cylinder shape :3
(progn
; CONFIG
(define RESOLUTION 20.0)
(define (build-cylinder sx sy res radius)
(let* ((angle-increment (/ (* 2 PI) res))
(points ()))
(do ((i 0 (+1 i)))
((>= i res) (progn (print points)
(make-sector-from-points 0.0 4.0 points)))
(let* ((angle (* i angle-increment))
(x (+ sx (* radius (cos angle))))
(y (+ sy (* radius (sin angle)))))
(set! points (cons (x y) points))))))
(fill-selection
(lambda (x1 y1 x2 y2 nh1 nh2 dir)
(build-cylinder (/ (+ x1 x2) 2) (/ (+ y1 y2) 2) RESOLUTION (* (abs (- x2 x1)) 0.5) ))))