next up previous contents index
Next: 7.30 data/examples/nurbsurf5.dat Up: 7. Source Files Previous: 7.28 data/examples/nurbsurf3.dat   Contents   Index


7.29 data/examples/nurbsurf4.dat


/*
 * FILE: nurbsurf4.dat
 *
 * nurbs surface with 3 trim regions. the orientation of some trim elements
 * has to be inverted, so that they fit together
 *
 */

/* 
 *  nurbs surface 
 */
surf1 = NURBSURF( 
  (0., 0., 1., 1.),
  (0., 0., 0., 0.5, 0.5, 1., 1., 1.),
  (
    ((5., 0.,  0., 0.5), (5., 5.,  0., 0.5)),
    ((5., 0., 2.5, 0.5), (5., 5., 2.5, 0.5)),
    ((5., 0.,  5., 1.),  (5., 10., 5., 1.)),
    ((0., 0., 2.5, 0.5), (0., 5., 2.5, 0.5)),
    ((0., 0.,  0., 0.5), (0., 5.,  0., 0.5))   
  )
);

/* 
 *  first region 
 */
con1 = POLYLINE2(
  ((0.,0.7), (0.,0.), (0.3,0.0), (0.3,0.25))
);
wrong_con2 = NURBCURV2(
  (0., 0., 0., 1., 1., 1.),
  (
    (0.45,0.4,1.0),
    (0.15,0.2,0.5),    /* (0.3,0.4)  */
    (0.15,0.125,0.5)   /* (0.3,0.25) */
  )
);
con2 = NURBSUBC2(
  (1,0),
  wrong_con2
);
con3 = POLYLINE2(
  ((0.45,0.4), (0.7,0.4))
);
con4 = NURBCURV2(
  (0., 0., 0., 0.5, 0.5, 1., 1., 1.),
  (
    (0.35,0.2,0.5),  /* (0.7,0.4) */
    (0.5,0.2,0.5),   /* (1.0,0.4) */
    (1.0,0.7,1.0),
    (0.5,0.5,0.5),   /* (1.0,1.0) */
    (0.35,0.5,0.5)   /* (0.7,1.0) */
  )
);
wrong_con5 = POLYLINE2(
  ((0.3,1.0), (0.7,1.0))
);
con5 = POLYLINESUB2(
  (1,0),
  wrong_con5
);
con6 = NURBCURV2(
  (0., 0., 0., 1., 1., 1.),
  (
    (0.15,0.5,0.5),  /* (0.3,1.0) */
    (0.0,0.5,0.5),   /* (0.0,1.0) */
    (0.0,0.7,1.0)
  )
);
reg1 = REGION( (con1,con2,con3,con4,con5,con6) );

/* 
 *  second region
 */
con7 = NURBCURV2( 
  (0., 0., 0., 0.25, 0.25, 0.5, 0.5, 0.75, 0.75, 1., 1., 1.),
  (
    (0.3,0.55,1.0),
    (0.075,0.275,0.5),  /* (0.15,0.55) */
    (0.075,0.35,0.5),    /* (0.15,0.7)  */
    (0.075,0.425,0.5),   /* (0.15,0.85) */
    (0.3,0.85,1.0),
    (0.225,0.425,0.5),  /* (0.45,0.85) */
    (0.225,0.35,0.5),   /* (0.45,0.7)  */
    (0.225,0.275,0.5),  /* (0.45,0.55) */
    (0.3,0.55,1.0)
  )
);
reg2 = REGION( (con7) );

/*
 *  third region
 */
con8 = NURBCURV2( 
  (0., 0., 0., 0.25, 0.25, 0.5, 0.5, 0.75, 0.75, 1., 1., 1.),
  (
    (0.7,0.55,1.0),
    (0.275,0.275,0.5),  /* (0.55,0.55) */
    (0.275,0.35,0.5),   /* (0.55,0.7)  */
    (0.275,0.425,0.5),  /* (0.55,0.85) */
    (0.7,0.85,1.0),
    (0.425,0.425,0.5),  /* (0.85,0.85) */
    (0.425,0.35,0.5),   /* (0.85,0.7)  */
    (0.425,0.275,0.5),  /* (0.85,0.55) */
    (0.7,0.55,1.0)
  )
);
reg3 = REGION( (con8) );

/* 
 *  trimmed nurbs surface 
 */
part1 = PARTITION( (reg1,reg2,reg3) );
trimsurf1 = TNURBSURF( part1, surf1 );

/*
 * material properties 
 */
front1 = FRONT_MATERIAL
(
  (0.05, 0.15, 0.075, 1.0),        /* diffuse color    */
  (0.0125, 0.0375, 0.019, 1.0),    /* ambient color    */
  (0.0, 0.0, 0.0, 1.0),            /* emissive color   */
  (0.2, 0.6, 0.3, 1.0),            /* specular color   */
  0.5                              /* shininess        */
);
back1 = BACK_MATERIAL
(
  (0.3, 0.15, 0.12, 1.0),          /* diffuse color    */
  (0.075, 0.0375, 0.03, 1.0),      /* ambient color    */
  (0.0, 0.0, 0.0, 1.0),            /* emissive color   */
  (0.8, 0.4, 0.3, 1.0),            /* specular color   */
  0.5                              /* shininess        */
);

/*
 *  scene graph 
 */
SCENEROOT = SCENENODE ( 
  (), 
  ( ATTRIBS(front1,back1) ), 
  (trimsurf1)
);


next up previous contents index
Next: 7.30 data/examples/nurbsurf5.dat Up: 7. Source Files Previous: 7.28 data/examples/nurbsurf3.dat   Contents   Index
Administrator 2002-01-20