[vtk-developers] Class design for spline visualizations

Lin M majcjc at gmail.com
Tue Jul 7 15:38:59 EDT 2015


Hi Dr. Thompson,

I read the document for BRep format and checked those files in CGM/test. It
seems that only a small part of the test files contains bezier/b-spline
surfaces and all these files contains quite a number of different kinds of
shapes. I can write a class to read such file but it will only display the
bezier/b-spline part. I'm afraid that it will just be a piece of the
original shape which the file represents. Do you think I should do that or
there is a better way to load external shape?

PS. I opened a new google doc to summarize what we have done now. I will
update new progress to it during the development. (link
<https://docs.google.com/document/d/1rziiXIfZAnij6x7cbubrZpxLABsuuxtOSLeq9L788r8/edit?usp=sharing>
)

Best,
Lin

On Thu, Jul 2, 2015 at 9:23 AM, David Thompson <david.thompson at kitware.com>
wrote:

> Hi Lin,
>
> > It works. :-)
> > I will look into the CGM then.
>
> Great. I am working on CGM as well, but you may beat me to it as my time
> is tight right now.
>
>         David
>
> >
> > On Tue, Jun 30, 2015 at 3:30 PM, Lin M <majcjc at gmail.com> wrote:
> > This is a good idea!
> >
> > On Tue, Jun 30, 2015 at 3:24 PM, David Thompson <
> david.thompson at kitware.com> wrote:
> > Hmmm. I think this would be a good time to use vtkMappedDataArray to
> create a version of the control point coordinates with 3 components that
> divides x, y, and z by the homogeneous coordinate. The vtkStructuredGrid's
> vtkPoints instance would own the vtkMappedDataArray, which would own a
> reference to the 4-component array (also owned by the PointData() of the
> vtkStructuredGrid).
> >
> > That will make rendering the control polygon easy and let
> GetDimensions() return the correct value. Just make sure that you call
> SetDimensions() before setting the vtkPoints array to be the
> vtkMappedDataArray.
> >
> >         David
> >
> > > On Jun 30, 2015, at 3:19 PM, Lin M <majcjc at gmail.com> wrote:
> > >
> > > Yes, I can store it in PointData(), but
> splineData->GetDimensions(numControlPointsPerAxis) will not return the
> correct number of control points. It will return {0,0,0} if we hold the
> control points in PointData(). Though we can also hold a simple 1*3 array
> in vtkFieldData just like we store the length of knot vectors.
> > >
> > > On Tue, Jun 30, 2015 at 2:10 PM, David Thompson <
> david.thompson at kitware.com> wrote:
> > > Hi Lin,
> > >
> > > > I didn't separate the homogenous coordinate with point coordinates
> but stored them all in a vtkDataArray with 4 components per tuple just as
> you suggest. In this way, vtkStructuredGrid cannot hold them as vtkPoints.
> The current API is like
> > > >
> > > > void vtkNURBSPatchAdaptor::GetPatchShape(vtkUnstructuredGrid*
> outputSp, vtkDataArray* ctrlPts, int* ctrlPtsNum)
> > > > the outputSp holds the surface mesh, ctrlPts and ctrlPtsNum hold
> information and data of nurbs control points, and the vtkSturcturedGrid
> only holds knot vectors and length.
> > >
> > > Actually, the vtkStructuredGrid can hold the control points as
> PointData() (as opposed to Point  coordinates). There is no constraint on
> the number of components per tuple. The idea is to access the control
> points and knot data like this:
> > >
> > >   vtkStructuredGrid* splineData;
> > >   vtkDataArray* controlPoints =
> splineData->GetPointData()->GetArrayByName("control polygon");
> > >   vtkDataArray* knotVector =
> splineData->GetFieldData()->GetArrayByName("knot vector");
> > >   int numControlPointsPerAxis[3];
> > >   splineData->GetDimensions(numControlPointsPerAxis);
> > >
> > > That way all of the spline data is grouped into one dataset; it's just
> that the splineData's vtkPoints would not hold the control points. We could
> also store additional information in the arrays of
> splineData->GetFieldData(). For example, flags indicating which axes (if
> any) were periodic could be stored in a separate field-data array since
> there is no constraint on the number of components or tuples of field-data
> arrays.
> > >
> > > Does that make sense?
> > >
> > >         David
> > >
> > >
> >
> >
> >
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20150707/578bc387/attachment-0001.html>


More information about the vtk-developers mailing list