diff options
author | Thomas Bushnell, BSG <tb@debian.org> | 2006-10-23 23:55:08 -0700 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2017-02-20 00:05:37 -0800 |
commit | 97fc07b2d8896b869db55827900f24e6528a9bd6 (patch) | |
tree | 262ed5c19ad83dd59aac33d2e04ace4fbd94bd3b /solid.scm | |
parent | 810b08c931e958fdaa6971b2ce8c5e578130d652 (diff) | |
parent | 5bea21e81ed516440e34e480f2c33ca41aa8c597 (diff) | |
download | slib-97fc07b2d8896b869db55827900f24e6528a9bd6.tar.gz slib-97fc07b2d8896b869db55827900f24e6528a9bd6.zip |
Import Debian changes 3a4-1debian/3a4-1
slib (3a4-1) unstable; urgency=low
* New upstream release.
* slib.texi (Library Catalogs): Repeat change from 3a3-3.
* Makefile: Repeat $(htmldir)slib_toc.html changes from 3a2-1.
Diffstat (limited to 'solid.scm')
-rw-r--r-- | solid.scm | 58 |
1 files changed, 58 insertions, 0 deletions
@@ -570,6 +570,22 @@ (solid:node "Box" (sprintf #f "size %s" (coordinate3string geom))))) +;;@body +;;Returns a box of the specified @1, but with the y-axis of a texture +;;specified in @2 being applied along the longest dimension in @1. +(define (solid:lumber geometry appearance) + (define x (car geometry)) + (define y (cadr geometry)) + (define z (caddr geometry)) + (cond ((and (>= y x) (>= y z)) + (solid:box geometry appearance)) + ((and (>= x y) (>= x z)) + (solid:rotation '(0 0 1) 90 + (solid:box (list y x z) appearance))) + (else + (solid:rotation '(1 0 0) 90 + (solid:box (list x z y) appearance))))) + ;;@args radius height appearance ;;@args radius height ;;Returns a right cylinder with dimensions @code{(abs @1)} and @code{(abs @2)} @@ -693,6 +709,48 @@ ((negative? idx) (apply string-append lst))))))) +;;@args xz-array y appearance +;;@args xz-array y +;;@1 must be an @var{n}-by-2 array holding a sequence of coordinates +;;tracing a non-intersecting clockwise loop in the x-z plane. @0 will +;;close the sequence if the first and last coordinates are not the +;;same. +;; +;;@0 returns a capped prism @2 long. +(define (solid:prism xz-array y . appearance) + (define y/2 (/ y 2)) + (define dims (array-dimensions xz-array)) + ;;(define (sfbool bool) (if bool "TRUE" "FALSE")) + (if (not (eqv? 2 (cadr dims))) (slib:error 'solid:prism 'dimensions dims)) + (sprintf #f + "\ +Shape { + %s + geometry Extrusion { + convex FALSE + endCap TRUE + beginCap TRUE + spine [0 %g 0, 0 %g 0] + crossSection [%s] + } +} +" + (if (null? appearance) "" (car appearance)) + (- y/2) y/2 + (do ((str (if (and (= (array-ref xz-array (+ -1 (car dims)) 0) + (array-ref xz-array 0 0)) + (= (array-ref xz-array (+ -1 (car dims)) 1) + (array-ref xz-array 0 1))) + "" + (sprintf #f "%g, %g\n" + (array-ref xz-array (+ -1 (car dims)) 0) + (array-ref xz-array (+ -1 (car dims)) 1))) + (string-append str (sprintf #f " %g, %g\n" + (array-ref xz-array idx 0) + (array-ref xz-array idx 1)))) + (idx 0 (+ 1 idx))) + ((>= idx (car dims)) str)))) + ;;@args width height depth colorray appearance ;;@args width height depth appearance ;;@args width height depth |