next up previous contents index
Next: 5.4 Trimmed Nurbs Surfaces Up: 5. Examples Previous: 5.2 Nurbs Surfaces   Contents   Index

5.3 Tesselation of Nurbs

On default nurbs surfaces and curves are tesselated with a tolerance which is equal to 0.001 * diameter of the bounding box of the control points. In Example 9 this tolerance is raised to 0.01. The result is shown in Figure 5.6. You will notice that both surfaces are tesselated with the same relative fineness.

Example 9: (taken from: data/examples/nurbsurf5.dat (7.30))

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))   
  )
);
trans1 = TRNSFMAT ( 
  0.3, 0., 0., 0.,
  0., 0.3, 0., 0.,
  0., 0., 0.3, 0.,
  6., -2., 10., 1.
);
node2 = SCENENODE(
  (),
  (
    TRANSFORMS(trans1), ATTRIBS(front1, back1)
  ),
  (surf1)
);
SCENEROOT = SCENENODE(
  (node2),
  (
    ATTRIBS(front2, back2, TESSTOL(0.01), OUTLINETRI(1))
  ),
  (surf1)
);

Figure 5.6: Tesselating with the same relative fineness
\begin{figure}\centering\includegraphics{nurbstol1.ps}
\end{figure}

But one often wants that all surfaces in a scene are tesselated with the same absolute fineness, especially when there are very big and very small surfaces present in the same scene. It is possible to achieve this by defining a box and saying that the tesselation tolerance shall be relative to the diameter of this box. Thus it isn't necessary to know the absolute size of the scene and setting a absolute tesselation tolerance.

This is done in Example 10 and the output is shown in Figure 5.7.

Figure 5.7: Tesselating with a tolerance relative to a fixed box
\begin{figure}\centering\includegraphics{nurbstol2.ps}
\end{figure}

Example 10: (taken from: data/examples/nurbsurf6.dat (7.31))

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))   
  )
);
trans1 = TRNSFMAT ( 
  0.3, 0., 0., 0.,
  0., 0.3, 0., 0.,
  0., 0., 0.3, 0.,
  6., -2., 10., 1.
);
node2 = SCENENODE(
  (),
  (
    TRANSFORMS(trans1), ATTRIBS(front1, back1)
  ),
  (surf1)
);
node1 = SCENENODE(
  (node2),
  (
    ATTRIBS(front2, back2, TESSTOL(0.01), OUTLINETRI(1))
  ),
  (surf1)
);

func1 = SCENENODE_GETBBOX((node1));

SCENEROOT = SCENENODE(
  (node1),
  (
    ATTRIBS( SETBOX([func1]), USEBOXRELTESS(1) )
  ),
  ()
);


next up previous contents index
Next: 5.4 Trimmed Nurbs Surfaces Up: 5. Examples Previous: 5.2 Nurbs Surfaces   Contents   Index
Administrator 2002-01-20