Virtual Table http://swiss.csail.mit.edu/~jaffer/Solid

Scheme for Solid Modeling


Even with dimensioned drawings, the results of my woodworking projects may look rather unlike my expectations. Why not model projects in the computer before putting tooth to grain?

The GNU/Linux mechanical CAD programs I found suffer from rodent-infested graphical user interfaces, requiring prolonged toil at the limits of eye-hand coordination; merely to make edges parallel and perpendicular for the vast majority of boards. There must be a better way! With various VRML browsers available, is Virtual Reality Modeling Language the way to visualize wood?

Direct authoring of VRML was not a goal of The Virtual Reality Modeling Language International Standard ISO/IEC 14772-1:1997, which gives as a Design Criteria:

Authorability
Enable the development of computer programs capable of creating, editing, and maintaining VRML files, as well as automatic translation programs for converting other commonly used 3D file formats into VRML files.

In contrast to the large body of hand-coded HTML pages from thousands of authors, most VRML97 web-pages I found have syntax errors; and many of these can not be displayed by GNU/Linux browsers. Most have no lighting or background, making it easy to lose the object of interest in the default black background.

Unlike HTML, VRML97 is not compact. Its field names duplicate its node names except for capitalization; and these appear together looking like written stuttering. It employs both [] and {} even though scope of a single grouping pair would be clear from context. Both of these properties provide twice the opportunities for error with no attendant benefit to clarity.

Even with control of a translation process, VRML97's conceptual shortcomings are difficult hide from the user. The scope of illumination is the scope of the enclosing Transform or Group node. Thus the light from a lamp cannot be directed by the same transform which orients the lamp unless all objects on which it shines are also affected by that same transform.

Functional Design

Here is an example use of my solid modeling package released in the SLIB Scheme Library.

A table was my first test case. Its legs, rails, and styles are repeated in rectangular grids, centered under a symmetrical table top. Each primitive's coordinates are relative to its center.

An alternate approach would be of legs under the top; rails between the legs; and styles between the rails. But the coordinates of each component in the directions perpendicular to their major axes need to be specified. With the hierarchy organized by adjacency, this information does not flow naturally.

The functional approach is clean, but not powerful enough. I think the direction for the future is that each function will instantiate an object or group in a database and return its instance token. The functions will allow a variable or linear expression as a dimension argument. Calls not in the object hierarchy will add contact and support constraints to instance tokens. And matrix algebra will solve the constraints for the dimension variables.

Dimensions are in inches because lumber is sold that way in my locale.
;;;; "table.scm" Bluestone table on patio.
(require 'solid)
(define inch 25.4e-3)                   ; 25.4.mm
First create the surfaces for bluestone and wood from monochromatic intensity maps (pictures).
(define bluestone
  (solid:texture "greystone.jpg" (solid:color '(.3 .3 .5) .65)))
(define douglas-fir
  (solid:texture "wood_g.jpg" (solid:color '(.7 .6 .2) .5)))
The bluestone top is simple:
(define slab (solid:box '(20.5 2 12) bluestone))
Next make the legs, rails, and styles. The rails are created vertically, then rotated so that the woodgrain runs along the length rather than across the width.
(define leg (solid:box '(1.25 22 1.25) douglas-fir))
(define long-rail
  (solid:rotation '(0 0 1) 90
		  (solid:box '(.75 15.5 .75) douglas-fir)))
(define short-rail
  (solid:rotation '(1 0 0) 90
		  (solid:box '(.75 9 .75) douglas-fir)))
(define style (solid:cylinder .375 -4 douglas-fir))
With the pieces already oriented, translation and repetition are all that is needed to finish assembly of the table. The overall upward translation by 11 inches puts the leg tips at 0.
(define table
  (solid:translation
   '(0 11 0)
   (solid:translation '(0 12 0) slab)
   (solid:translation
    '(0 3 0)
    (solid:center-array-of 2 2 short-rail '(15.5 0 0) '(0 4 0))
    (solid:center-array-of 2 2 style '(15.5 0 0) '(0 0 1.5)))
   (solid:translation
    '(0 5 0)
    (solid:center-array-of 2 2 long-rail '(0 4 0) '(0 0 9))
    (solid:center-array-of 3 2 style '(1.5 0 0) '(0 0 9)))
   (solid:center-array-of 2 2 leg '(15.5 0 0) '(0 0 9))))
Create a patio from a photograph of one cell of the paver pattern.
(define patio
  (let ((repeat 9))
    (solid:translation
     '(0 -1.5 0)
     (solid:box `(,(* 15 repeat) 3 ,(* 15 repeat))
		(solid:texture "paver.jpg"
			       (solid:color '(1 .9 .95) .4)
			       repeat)))))
Here are two objects on the table (at 24 inch altitude).
(define curios
  (solid:translation
   '(0 24 0)
   (solid:translation
    '(-7 2 4)
    (solid:pyramid 4 4 (solid:color '#(1 .8 0) .4 '#(1 .9 .5) .8)))
   (solid:translation
    '(0 0.95 0)
    (solid:rotation '(0 0 1)
		    (+ -90 (/ (asin (/ .036 .32)) pi/180))
		    (solid:scale (/ inch) (solid:arrow))))))
The rest creates viewpoints, backdrop, and daylight.
(vrml-to-file
 "table.wrl"
 (world:info "Bluestone Table")
 "NavigationInfo {headlight FALSE} avatarSize [0.01, 0.01, 0.01]}"

 (solid:translation '(0 .35 0) (scene:viewpoint "Photo" 1.3 0 -15.1))
 (solid:translation '(0 .5 0) (scene:viewpoints 1.3))
 (scene:sky-and-dirt)
 (scene:sun 42 340 9 2 1.5)
 (solid:scale inch
	      (solid:rotation '(0 1 0) 21
			      curios
			      table)
	      patio))

table.scm
Bluestone Table


I am a guest and not a member of the MIT Computer Science and Artificial Intelligence Laboratory.  My actions and comments do not reflect in any way on MIT.
agj @ alum.mit.edu
Go Figure!