[vtk-developers] Class design for spline visualizations

Lin M majcjc at gmail.com
Thu Jun 25 19:29:02 EDT 2015


Your last message is quite informative. I think it is mainly to implement a
method in vtkPatchInterpolation which takes in a bezier patch, number of
samples and return a vtkUnstructuredGrid?

Best,
Lin

On Thu, Jun 25, 2015 at 7:07 PM, David Thompson <david.thompson at kitware.com>
wrote:

> Hi Lin,
>
> That sounds great. While I take a look at it, perhaps you could work on
> generating triangle strips for surfaces? Then we will be ready to render 2D
> versions as part of the test for knot insertion.
>
> Do you need more information on triangle strips in VTK or was my last
> message enough?
>
>         Thanks,
>         David
>
> > On Jun 25, 2015, at 7:04 PM, Lin M <majcjc at gmail.com> wrote:
> >
> > Hi Dr.Thompson,
> >
> > I added the method to insert a knot multiple times based on the
> algorithm in the NURBS book. It supports knot insertion for 3-d patches if
> it works correctly. I tested it in 1-d case and it works well.
> >
> > Best,
> > Lin
> >
> > On Wed, Jun 24, 2015 at 4:38 PM, Lin M <majcjc at gmail.com> wrote:
> > Hi Dr. Thompson,
> >
> > I implemented the InserKnot() method. Currently the API is like:
> >
> > void InsertKnot(
> >     vtkDataArray* pointsOut, int* knotsLenNew, double* knotsArrNew, int*
> ctrlPtsNumNew,
> >     double tNew, int insertDim,
> >     vtkDataArray* pointsIn, int* knotsLen, double* knotsArr, int*
> ctrlPtsNum);
> >
> > I have submitted the code to gitlab (
> https://gitlab.kitware.com/splines/vtk/merge_requests/4). Please take a
> look at it. Thanks.
> >
> > Best,
> > Lin
> >
> > On Wed, Jun 24, 2015 at 10:43 AM, Lin M <majcjc at gmail.com> wrote:
> > Hi Dr. Thompson,
> >
> > I'm writing the knot insertion method InsertKnot() and I hope it can be
> used to handle both 1-d, 2-d and 3-d cases.
> >
> > 1. One question is that when converting a nurbs curve to a bezier curve,
> eaca segment of a nurbs curve will correspond to a new bezier curve. So we
> need to repeatedly retrieve a subset of the control points and the knot
> vector from the original nurbs curve. To make the InserKnot() method more
> generally. I define the API as
> >
> > void InsertKnot(
> > vtkPoints* pointsOut,
> > double tNew, int dim,
> > vtkPoints* pointsIn, int* knotsLen, double* knotsArr)
> >
> > // pointsOut stores the new control points
> > // tNew is the new knot we want to insert
> > // dim is the dimension where the new knot is
> > // pointsIn is the old control points (which is probably a subset of the
> original nurbs control points)
> > // knotsLen stores the number of entries of the knots vector in each
> dimension (I'll assume it is always a 1*3 int array)
> > // knotsArr stores the knot vector for all dimensions
> >
> > Do you think this API is proper?
> >
> > 2. The second question is that, as described in the first question, a
> p-degree nurbs curve with a given knot vector actually will generate a
> series of bezier curve. Each of the them corresponds to a segment of the
> original nurbs curve. How can I find the subset of the control points and
> knot vector for a segment?
> >
> > Best,
> > Lin
> >
> > On Mon, Jun 22, 2015 at 6:54 PM, David Thompson <
> david.thompson at kitware.com> wrote:
> > Hi Lin,
> >
> > > 1. The definition of knot vector seems to be a little different from
> the NURBS book. In the NURBS book, a knot vector is defined as U =
> {a,...,a,u_{p+1},...,u_{m-p-1},b,...,b} where a and b are repeated p+1
> times (p is the degree of NURBS curve). And since NURBS cruve  is defined
> as C(u) = sum_{i,n}(N_{i,p}(u)*P_{i}),  the endpoints seems to be
> interpolated as well.
> >
> > NURBS do not require any knot vector entries to be repeated. Many
> examples in the NURBS book *happen* to have repeated entries, but it is not
> a requirement.
> >
> > > ...
> > > 2. The previous section of the wiki page writes "The number of knots
> is always equal to the number of control points plus curve degree plus one
> (i.e. number of control points plus curve order)." Should it be degree + N
> + 1 = K ?
> >
> > From the wikipedia entry: "Some modelers that use older algorithms for
> NURBS evaluation require two extra knot values for a total of (degree+N+1)
> knots.[7]"  You can use whichever you like. I would advise sticking with
> the NURBS book because it has many examples worked out in detail. (The
> NURBS book appears to use the degree + N + 1 = K formulation.)
> >
> > > 3. I think the inference is only for a single patch.  If there are
> several patches in the vtkStructuredGrid, we can not get the number of
> control points for a certain patch by vtkStructuredGrid->GetDimension()
> unless we know the number of patches and the number of control points are
> the same for all these patches.
> >
> >
> > Nope, you can use GetDimension() to discover the number, N, of control
> points for all patches. That is related to the degree by the number of knot
> vector entries for all patches. We have not specified how the knot vector
> would be stored. If stored as an array in vtkFieldData, then   we would
> also have to store the number entries along each axis (the equivalent
> information as GetDimension() returns for the control points). Or we could
> store the degree along each axis and use that to determine the size of the
> knot vector along each axis... whichever you prefer.
> >
> >         David
> >
> >
> >
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20150625/84f00506/attachment-0001.html>


More information about the vtk-developers mailing list