[vtk-developers] vtkClipPolyData

David Gobbi david.gobbi at gmail.com
Mon Dec 21 12:14:26 EST 2009


On Mon, Dec 21, 2009 at 9:58 AM, David Doria <daviddoria+vtk at gmail.com> wrote:
>
> On Mon, Dec 21, 2009 at 9:17 AM, Jerald Zhao <jeraldzh at gmail.com> wrote:
>>
>> Hi everyone,
>>
>> I'm a new to VTK.
>>
>>
>>
>>
>> http://public.kitware.com/cgi-bin/viewcvs.cgi/*checkout*/Graphics/Testing/Tcl/capCow.tcl?root=VTK&content-type=text/plain
>> Is it possible to apply above code to vtkstructuredpointsreader class.
>>
>> ###
>> # Read the polygonal data and generate vertex normals
>> vtkBYUReader cow
>>   cow SetGeometryFileName "$VTK_DATA_ROOT/Data/Viewpoint/cow.g"
>> vtkPolyDataNormals cowNormals
>>   cowNormals SetInputConnection [cow GetOutputPort]
>> ###
>>
>> In my sight, these codes should be changed to below
>>
>> ###
>> # Read the polygonal data and generate vertex normals
>> vtkStructuredPointsReader cow
>>   cow SetFileName "g";
>> vtkPolyDataNormals cowNormals
>>   cowNormals SetInputConnection [cow GetOutputPort]
>> ###
>>
>> However, the result were below
>> ###
>> ERROR: In C:\vtk\src\Filtering\vtkDemandDrivenPipeline.cxx, line 828
>> vtkStreamingDemandDrivenPipeline (0x087C5730): Input for connection index
>> 0 on input port index 0 for algorithm vtkPolyDataNormals(0x087C58A8) is of
>> type vtkStructuredPoints, but a vtkPolyData is required.
>> ERROR: In C:\vtk\src\Filtering\vtkDemandDrivenPipeline.cxx, line 828
>> vtkStreamingDemandDrivenPipeline (0x087C5730): Input for connection index
>> 0 on input port index 0 for algorithm vtkPolyDataNormals(0x087C58A8) is of
>> type vtkStructuredPoints, but a vtkPolyData is required.
>> ERROR: In C:\vtk\src\Filtering\vtkDemandDrivenPipeline.cxx, line 828
>> vtkStreamingDemandDrivenPipeline (0x087C5730): Input for connection index
>> 0 on input port index 0 for algorithm vtkPolyDataNormals(0x087C58A8) is of
>> type vtkStructuredPoints, but a vtkPolyData is required.
>> ERROR: In C:\vtk\src\Filtering\vtkDemandDrivenPipeline.cxx, line 828
>> vtkStreamingDemandDrivenPipeline (0x087C5730): Input for connection index
>> 0 on input port index 0 for algorithm vtkPolyDataNormals(0x087C58A8) is of
>> type vtkStructuredPoints, but a vtkPolyData is required.
>> ###
>>
>> where did I make a mistake?
>>
>>
>> Regards,
>> Jerald
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at
>> http://www.kitware.com/opensource/opensource.html
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.vtk.org/mailman/listinfo/vtk-developers
>>
>>
>
> Jerald,
>
> This type of question is much more appropriate for the vtk users list rather
> than the developers list:
> vtkusers at vtk.org
>
> The error:
> port index 0 for algorithm vtkPolyDataNormals is of type
> vtkStructuredPoints, but a vtkPolyData is required.
>
> Means that you are passing the vtkPolyDataNormals filter the wrong data
> type. An easy way to fix this is to first convert your vtkStructuredPoints
> to a vtkPolyData, since poly data is more "general" than structured points.
>
> Anyone know why there are no normal filters for non-polydata objects?
>
> Thanks,
>
> David

Computing a normal for each point in a dataset only really makes sense
if you have a surface, which means a lot of adjacent 2D cells.  That's
why there's a normal filter for polydata: a polydata is guaranteed not
to have any 3D cells.

All the other datasets can have 3D cells and can have points that are
not on the surface.  There isn't a good, general way of defining a
"normal" for such points (except for defining the "normal" as the
"gradient", but that's a whole 'nother can of worms).

PolyData isn't any more or less general than StructuredPoints, just
different.  The only true "general" dataset is UnstructuredPoints,
since it can have cells of any type.

  David



More information about the vtk-developers mailing list