[vtk-developers] Class design for spline visualizations
Lin M
majcjc at gmail.com
Tue Jun 30 16:55:43 EDT 2015
It works. :-)
I will look into the CGM then.
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/20150630/09dbd136/attachment-0001.html>
More information about the vtk-developers
mailing list