[vtk-developers] BestFitPlane function for vtkPlane

David Doria daviddoria+vtk at gmail.com
Wed Nov 11 14:22:05 EST 2009


On Tue, Nov 10, 2009 at 11:29 PM, Karthik Krishnan
<karthik.krishnan at kitware.com> wrote:
> On Wed, Nov 4, 2009 at 2:21 PM, David Doria <daviddoria+vtk at gmail.com>
> wrote:
>>
>> On Wed, Nov 4, 2009 at 12:20 PM, Karthik Krishnan
>> <karthik.krishnan at kitware.com> wrote:
>> > Thanks
>>
>>
>> These tests failed before my changes and after:
>> The following tests FAILED:
>>         93 - SurfacePlusEdges (Failed)
>>        105 - TestLabelPlacementMapper (SEGFAULT)
>>
>> but everything else passes with the changes. Here are the files:
>> http://www.rpi.edu/~doriad/VTK_List/vtkPlane/
>>
>> I wasn't sure how to get a vtkPoints from a vtkDataSet, so I did this:
>>
>> void vtkTextureMapToPlane::ComputeNormal(vtkDataSet *input)
>> {
>>  vtkSmartPointer<vtkPoints> Points = vtkSmartPointer<vtkPoints>::New();
>>  for(unsigned int i = 0; i < input->GetNumberOfPoints(); i++)
>>    {
>>    double p[3];
>>    input->GetPoint(i, p);
>>    Points->InsertNextPoint(p);
>>    }
>
> Not a fan of copying the entire list of points and retrieving the same back
> from vtkPlane. The copy seems quite unncessary.
>
> It merely seems to satisfy your API in vtkPlane, which takes in a vtkPoints
> as input to compute the best fit plane, while vtkTextureMapToPlane takes in
> any vtkDataSet as input.
>
> What I would instead do is add an overloaded API to vtkPlane that can take
> in both a vtkDataSet and a vtkPoints.
>
> something like :
>
>   vtkPlane::ComputeBestFittingPlane( vtkPoints *points )
>      {
>      ...
>      }
>
>   vtkPlane::ComputeBestFittingPlane( vtkDataSet *dataset )
>      {
>      ...
>      }
>
>
> Apart from the unnecessary copy, things look good.
>

Can we address the problem more directly and add a method to get a
vtkPoints from a vtkDataSet? This seems like a reasonable thing to be
able to do, do you agree?

Thanks,

David



More information about the vtk-developers mailing list