Random Bits of Open Code

Check-in [6da40221e5]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Added torus
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:6da40221e52730e250706b21d3fb214701c94088
User & Date: matt 2019-05-08 05:54:04
Context
2019-05-20
19:44
pull in modularize-debug changes check-in: 5b014bb206 user: mrwellan tags: trunk
2019-05-08
05:54
Added torus check-in: 6da40221e5 user: matt tags: trunk
2019-05-07
04:43
Resurected textcalc check-in: 9c9044594c user: matt tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to a3d/a3d.scm.

3
4
5
6
7
8
9

10
11
12
13
14
15
16
...
361
362
363
364
365
366
367












368
369
370
371
372
373
374
    (*mode*
     *indent*
     ;; objects
     cube cubev
     cylinder
     sphere
     rounded-box

     ;; operations
     difference
     union
     intersection
     translate
     rotate
     mirror
................................................................................
	(sphere r      highlight: highlight)
	(dec-indent)
	"}"))
      ((povray)
       (conc *indent* "object { Round_Box( <0,0,0>," (vec->string v) "," r ",0) "
	   (pigment->string pigment texture) ;; (if pigment (conc " texture { pigment { color " (color->string pigment) " } } ") "")
	   " }")))))













;; Round_Box(<0,0,0>,<1,0.5,2>, 0.125, 0)
(define (camera location look-at #!key (show #f)) ;; show in scad
  (case *mode*
    ((openscad) (if show
		    (union
		     (translate location (sphere 5 pigment: 'white))







>







 







>
>
>
>
>
>
>
>
>
>
>
>







3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
...
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
    (*mode*
     *indent*
     ;; objects
     cube cubev
     cylinder
     sphere
     rounded-box
     torus
     ;; operations
     difference
     union
     intersection
     translate
     rotate
     mirror
................................................................................
	(sphere r      highlight: highlight)
	(dec-indent)
	"}"))
      ((povray)
       (conc *indent* "object { Round_Box( <0,0,0>," (vec->string v) "," r ",0) "
	   (pigment->string pigment texture) ;; (if pigment (conc " texture { pigment { color " (color->string pigment) " } } ") "")
	   " }")))))

(define (torus major minor #!key (theta #f)(highlight #f)(pigment #f)(texture #f))
  (conc *indent*
	(case *mode*
	  ((openscad)
	   (conc (pigment->string pigment texture) ;; (if pigment (conc "color(" (color->string pigment) ")") "")
		 (if highlight "#" "")
		 "rotate_extrude(" (if theta (conc "angle=" theta ", ") "") " convexity=10) translate([" major ", 0]) circle(" minor ");"))
	  ((povray)
	   (conc "torus{ " major "," minor 
		 (pigment->string pigment texture) ;; (if pigment (conc " pigment { color " (color->string pigment) " } ") "")
		 " }")))))

;; Round_Box(<0,0,0>,<1,0.5,2>, 0.125, 0)
(define (camera location look-at #!key (show #f)) ;; show in scad
  (case *mode*
    ((openscad) (if show
		    (union
		     (translate location (sphere 5 pigment: 'white))