(use srfi-1) (use ports) (include "vector3d.scm") (include "dsum2.scm") (include "read-stl-2.scm") (define (fun1 f) (let* ((k (/ (* 8.0 (atan 1.0) f) 340.0)) (ka (* k 0.02)) (ka2 (* ka ka))) (/ ka2 (+ 1.0 ka2)))) (define go (lambda () (let* ((cl (argv)) (pi (* 4.0 (atan 1.0))) (fname (list-ref cl 1)) (x0 (string->number (list-ref cl 2))) (y0 (string->number (list-ref cl 3))) (z0 (string->number (list-ref cl 4))) (s (string->number (list-ref cl 5))) (str1 (list-ref cl 6)) (fun (cond ((file-exists? str1) (with-input-from-file str1 (lambda () (let ((sexp (read))) (if (eq? (car sexp) 'lambda) (eval sexp) (lambda (x) 1.0)))))) ((string-ci=? (substring str1 0 7) "#lambda") (call-with-input-string str1 (lambda (ip) (eval (read ip))))) (else (lambda (x) 1.0)))) (mesh (read-mesh fname x0 y0 z0 s fun)) (l (map (lambda (x) (list x (/ (double-sum-mesh mesh (* 2.0 pi x (/ 340.0)) 1.225 340.0) (* 340 1.225 2.0 pi 0.02 0.02)))) (map exact->inexact (iota 81 0 250)))) (outfile "out.txt")) (if (file-exists? outfile) (delete-file outfile) #f) (with-output-to-file outfile (lambda () (for-each (lambda (e) (display (car e)) (display " ") (display (fun1 (car e))) (display " ") (display (cadr e)) (newline)) l)))))) (go)