[vtk-developers] BestFitPlane function for vtkPlane

David Doria daviddoria+vtk at gmail.com
Tue Nov 10 17:15:16 EST 2009


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);
>    }
>
> which surely can be replaced.
>
> Thoughts?
>
> Thanks,
>
> David
>

Any other comments? What else needs to be done before this can be committed?

Also, what is the reason for the static functions, e.g.
static void ProjectPoint(double x[3], double origin[3], double normal[3])

Wouldn't it be easier to do
MyPlane->ProjectPoint(x[3])

instead of

double n[3];
MyPlane->GetNormal(n);
double o[3];
MyPlane->GetOrigin(o);
vtkPlane::ProjectPoint(x[3], o[3], n[3])

Thanks,

David



More information about the vtk-developers mailing list