[vtkusers] vtkPolygon::PoinInPolygon and normals
Jothy
jothybasu at gmail.com
Fri Jul 22 07:27:54 EDT 2011
Thanks David, I have have already corrected this silly mistake.
Jothy
On Fri, Jul 22, 2011 at 12:24 PM, David Doria <daviddoria at gmail.com> wrote:
> On Fri, Jul 22, 2011 at 5:43 AM, Jothy <jothybasu at gmail.com> wrote:
>>
>> Hi all,
>>
>> I have a vtkPolyData (generated from vtkDiscreteMarchingCubes) and I
>> need to find out the points inside this 3D polygon. I looked at this
>> example in wiki
>>
>> http://www.vtk.org/Wiki/VTK/Examples/Cxx/Utilities/PointInPolygon.
>>
>> I tried to calculate the normal like
>>
>> vtkSmartPointer<vtkPolygon> polygon =
>> vtkSmartPointer<vtkPolygon>::New();
>> double n[3];
>> //pd=vtkPolyData (mesh)
>> polygon->ComputeNormal(pd->GetPoints()->GetNumberOfPoints(),
>>
>> static_cast<double*>(pd->GetPoints()->GetData()->GetVoidPointer(0)),
>> n);
>>
>> but qDebug()<<n;//similar to std::cout
>>
>> it prints a hexadecimal number.
>>
>> I don't understand how to do this correctly.
>>
>> Also, should I calculate this normal for each point I am testing.
>>
>> Thanks
>>
>> Jothy
>
> 'n' is an array, so the hex number you are seeing is a memory address of the
> first element of n.
> You should see what you expect with
> cout << n[0] << " " << n[1] << " " << n[2];
> David
More information about the vtkusers
mailing list