next up previous contents index
Next: 7.44 data/models/galleon.dat Up: 7. Source Files Previous: 7.42 data/examples/syntax_ok.dat   Contents   Index


7.43 data/examples/write_fileformat_obj1.dat


/*
 * FILE: write_fileformat_obj1.dat
 *
 * Does a global surface approximation and writes the result
 * into an Alias Wavefront OBJ file. Afterwards the OBJ
 * file is loaded and displayed
 */

surf1 = NUBGAS( 
  3,       /* degree U */
  8,      /* number of control points for U */
  3,       /* degree V */
  8,      /* number of control points for V */
  (        /* matrix of data points: */
    ((0,0,0),(1,0,0),(2,0,0),(3,0,0), (4,0,1), 
     (5,0,2),(6,0,2),(7,0,2),(8,0,2), (9,0,3),
     (10,0,4),(11,0,4),(12,0,4),(13,0,4)),
    ((0,1,0),(1,1,0),(2,1,0),(3,1,0), (4,1,1), 
     (5,1,2),(6,1,2),(7,1,2),(8,1,2), (9,1,3),
     (10,1,4),(11,1,4),(12,1,4),(13,1,4)),
    ((0,2,0),(1,2,0),(2,2,0),(3,2,0), (4,2,1), 
     (5,2,2),(6,2,2),(7,2,2),(8,2,2), (9,2,3),
     (10,2,4),(11,2,4),(12,2,4),(13,2,4)),
    ((0,3,0),(1,3,0),(2,3,0),(3,3,0), (4,3,1), 
     (5,3,2),(6,3,2),(7,3,2),(8,3,2), (9,3,3),
     (10,3,4),(11,3,4),(12,3,4),(13,3,4)),

    ((0,4,1),(1,4,1),(2,4,1),(3,4,1), (4,4,2), 
     (5,4,3),(6,4,3),(7,4,3),(8,4,3), (9,4,4),
     (10,4,5),(11,4,5),(12,4,5),(13,4,5)),

    ((0,5,2),(1,5,2),(2,5,2),(3,5,2), (4,5,3), 
     (5,5,4),(6,5,4),(7,5,4),(8,5,4), (9,5,5),
     (10,5,6),(11,5,6),(12,5,6),(13,5,6)),
    ((0,6,2),(1,6,2),(2,6,2),(3,6,2), (4,6,3), 
     (5,6,4),(6,6,4),(7,6,4),(8,6,4), (9,6,5),
     (10,6,6),(11,6,6),(12,6,6),(13,6,6)),
    ((0,7,2),(1,7,2),(2,7,2),(3,7,2), (4,7,3), 
     (5,7,4),(6,7,4),(7,7,4),(8,7,4), (9,7,5),
     (10,7,6),(11,7,6),(12,7,6),(13,7,6)),
    ((0,8,2),(1,8,2),(2,8,2),(3,8,2), (4,8,3), 
     (5,8,4),(6,8,4),(7,8,4),(8,8,4), (9,8,5),
     (10,8,6),(11,8,6),(12,8,6),(13,8,6)),

    ((0,9,3),(1,9,3),(2,9,3),(3,9,3), (4,9,4), 
     (5,9,5),(6,9,5),(7,9,5),(8,9,5), (9,9,6),
     (10,9,7),(11,9,7),(12,9,7),(13,9,7)),

    ((0,10,4),(1,10,4),(2,10,4),(3,10,4), (4,10,5), 
     (5,10,6),(6,10,6),(7,10,6),(8,10,6), (9,10,7),
     (10,10,8),(11,10,8),(12,10,8),(13,10,8)),
    ((0,11,4),(1,11,4),(2,11,4),(3,11,4), (4,11,5), 
     (5,11,6),(6,11,6),(7,11,6),(8,11,6), (9,11,7),
     (10,11,8),(11,11,8),(12,11,8),(13,11,8)),
    ((0,12,4),(1,12,4),(2,12,4),(3,12,4), (4,12,5), 
     (5,12,6),(6,12,6),(7,12,6),(8,12,6), (9,12,7),
     (10,12,8),(11,12,8),(12,12,8),(13,12,8)),
    ((0,13,4),(1,13,4),(2,13,4),(3,13,4), (4,13,5), 
     (5,13,6),(6,13,6),(7,13,6),(8,13,6), (9,13,7),
     (10,13,8),(11,13,8),(12,13,8),(13,13,8))
  )
);
WRITE_FILEFORMAT_OBJ("\tmp\tmp.obj",surf1);

obj1 = READ_FILEFORMAT_OBJ( ("\tmp\tmp.obj") );
SCENEROOT = SCENENODE( ([obj1]), (), () );

And here is the created OBJ file:

v 0 0 0
v 0.365762 0 0.565503
v 2.91203 0 -1.34662
v 3.99123 0 2.6697
v 7.95563 0 1.19193
v 9.68843 0 4.56838
v 12.0974 0 3.92571
v 13 0 4
v 0 0.365762 0.565503
v 0.365761 0.36576 1.131
v 2.91203 0.365763 -0.781113
v 3.99123 0.365758 3.2352
v 7.95563 0.365762 1.75743
v 9.68842 0.365764 5.13389
v 12.0974 0.365759 4.49121
v 13 0.365762 4.5655
v 0 2.91203 -1.34662
v 0.365762 2.91203 -0.781111
v 2.91203 2.91203 -2.69323
v 3.99123 2.91203 1.32308
v 7.95563 2.91204 -0.154679
v 9.68843 2.91202 3.22176
v 12.0974 2.91204 2.5791
v 13 2.91203 2.65338
v 0 3.99123 2.6697
v 0.365761 3.99123 3.2352
v 2.91203 3.99124 1.32308
v 3.99123 3.99122 5.3394
v 7.95563 3.99123 3.86163
v 9.68842 3.99124 7.23809
v 12.0974 3.99123 6.59541
v 13 3.99123 6.6697
v 0 7.95563 1.19193
v 0.365762 7.95563 1.75744
v 2.91203 7.95562 -0.154685
v 3.99123 7.95563 3.86163
v 7.95563 7.95563 2.38386
v 9.68843 7.95561 5.76032
v 12.0974 7.95563 5.11764
v 13 7.95563 5.19194
v 0 9.68843 4.56838
v 0.365761 9.68841 5.13388
v 2.91203 9.68844 3.22177
v 3.99123 9.68842 7.23808
v 7.95563 9.68843 5.76032
v 9.68842 9.68844 9.13676
v 12.0974 9.68842 8.49409
v 13 9.68843 8.56838
v 0 12.0974 3.92571
v 0.365762 12.0974 4.49121
v 2.91203 12.0974 2.57909
v 3.99123 12.0974 6.59541
v 7.95563 12.0974 5.11764
v 9.68843 12.0974 8.49409
v 12.0974 12.0974 7.85142
v 13 12.0974 7.92571
v 0 13 4
v 0.365762 13 4.5655
v 2.91203 13 2.65338
v 3.99123 13 6.6697
v 7.95563 13 5.19194
v 9.68843 13 8.56838
v 12.0974 13 7.92571
v 13 13 8
cstype bspline
deg 3 3
surf 0 1 0 1 -64 -63 -62 -61 -60 -59 -58 -57 -56 -55 -54 -53 -52\
-51 -50 -49 -48 -47 -46 -45 -44 -43 -42 -41 -40 -39 -38 -37 -36\
-35 -34 -33 -32 -31 -30 -29 -28 -27 -26 -25 -24 -23 -22 -21 -20\
-19 -18 -17 -16 -15 -14 -13 -12 -11 -10 -9 -8 -7 -6 -5 -4 -3 -2 -1 
parm u 0 0 0 0 0.122809 0.359064 0.561405 0.808963 1 1 1 1 
parm v 0 0 0 0 0.122809 0.359064 0.561405 0.808963 1 1 1 1 
end


next up previous contents index
Next: 7.44 data/models/galleon.dat Up: 7. Source Files Previous: 7.42 data/examples/syntax_ok.dat   Contents   Index
Administrator 2002-01-20