[x3d-public] Fwd: Re: Nurbs control points, preweighted or not ?

J. Scheurich mufti11 at web.de
Fri May 22 07:09:57 PDT 2020


> There are no examples which use important weights, for testing. The github
> issue below has the torus example.
>
> The decision how to use NURBS has been made years ago by the
> blaxun/bitmanagment broser.
> With a modeller tool like whiite_dune you show the contolpointa, but
> not with a browser...
>
> A simple example of a shape using different NURBS wieghts is a sphere
> converted to a NumrbsPatchSurface
> with white_dune:
>
> #X3D V3.0 utf8
> PROFILE Interchange
> COMPONENT NURBS:1
>
> Transform {
> children
> Shape {
> appearance Appearance {
> material Material {
> }
> }
> geometry NurbsPatchSurface {
> uDimension 9
> vDimension 5
> uKnot         [
> 0
> 0
> 0
> 0.250000
> 0.250000
> 0.500000
> 0.500000
> 0.750000
> 0.750000
> 1
> 1
> 1
> ]
> vKnot         [
> 0
> 0
> 0
> 0.500000
> 0.500000
> 1
> 1
> 1
> ]
> controlPoint DEF Coordinate1 Coordinate {
> point           [
> 0 -1 0
> 0 -0.707107 0
> 0 -1 0
> 0 -0.707107 0
> 0 -1 0
> 0 -0.707107 0
> 0 -1 0
> 0 -0.707107 0
> 0 -1 0
> 0 -0.707107 -0.707107
> -0.500000 -0.500000 -0.500000
> -0.707107 -0.707107 0
> -0.500000 -0.500000 0.500000
> 0 -0.707107 0.707107
> 0.500000 -0.500000 0.500000
> 0.707107 -0.707107 0
> 0.500000 -0.500000 -0.500000
> 0 -0.707107 -0.707107
> 0 0 -1
> -0.707107 0 -0.707107
> -1 0 0
> -0.707107 0 0.707107
> 0 0 1
> 0.707107 0 0.707107
> 1 0 0
> 0.707107 0 -0.707107
> 0 0 -1
> 0 0.707107 -0.707107
> -0.500000 0.500000 -0.500000
> -0.707107 0.707107 0
> -0.500000 0.500000 0.500000
> 0 0.707107 0.707107
> 0.500000 0.500000 0.500000
> 0.707107 0.707107 0
> 0.500000 0.500000 -0.500000
> 0 0.707107 -0.707107
> 0 1 0
> 0 0.707107 0
> 0 1 0
> 0 0.707107 0
> 0 1 0
> 0 0.707107 0
> 0 1 0
> 0 0.707107 0
> 0 1 0
> ]
> }
> weight         [
> 1
> 0.707107
> 1
> 0.707107
> 1
> 0.707107
> 1
> 0.707107
> 1
> 0.707107
> 0.500000
> 0.707107
> 0.500000
> 0.707107
> 0.500000
> 0.707107
> 0.500000
> 0.707107
> 1
> 0.707107
> 1
> 0.707107
> 1
> 0.707107
> 1
> 0.707107
> 1
> 0.707107
> 0.500000
> 0.707107
> 0.500000
> 0.707107
> 0.500000
> 0.707107
> 0.500000
> 0.707107
> 1
> 0.707107
> 1
> 0.707107
> 1
> 0.707107
> 1
> 0.707107
> 1
> ]
> uClosed TRUE
> vClosed TRUE
> }
>      }

> }

As you see, the handles in white_dune are drawed inside a box, not with
"0.70710" numbers,
but in the "FieldView" the controlpoints and weigthts are listed without
multiplication-
.
This is so, cause the handle-places in the 3D Window are weigthed
contolpoints


 From wdune-1.874/src/NodeNurbsSurface.cpp:

     state.startDrawHandles();
     for (int ci = 0; ci < iuDimension * ivDimension; ci++) {
         bool hidden = false;
         for (int i = 0; i < m_scene->getNumHiddenVertices(); i++)
              if (m_scene->getHiddenVertex(i) == ci) {
                  hidden = true;
                  break;
              }
         if (hidden)
             continue;
         state.setHandleColor(m_scene, ci);
         glLoadName(ci);
state.drawHandle(Vec3f(getControlPoints()->getValue(ci)) /
                                weight()->getValue(ci));
     }
     state.endDrawHandles();

from wdune-1.874/src/RenderState.cpp

void
RenderState::drawHandle(const Vec3d &pos)
{
     Vec3d w = project(pos);

     float handleSize = TheApp->GetHandleSize();

     glBegin(GL_POLYGON);
     glVertex3d(w.x + handleSize, w.y - handleSize, w.z);
     glVertex3d(w.x + handleSize, w.y + handleSize, w.z);
     glVertex3d(w.x - handleSize, w.y + handleSize, w.z);
     glVertex3d(w.x - handleSize, w.y - handleSize, w.z);
     glEnd();
}

The decison about this was made from Stephan F. White 20 years ago, as
the blaxsum browser
introduced NURBS.

In principle ot would be possible to draw the controlpoints and the
weights (4 values indstead of 3) in
the Preview/Modelling  window, but who wants that ?

so øpmg
MUFTI




More information about the x3d-public mailing list