[vtkusers] In Python, is it possible to use class methods with array pointer inputs ?
David Gobbi
david.gobbi at gmail.com
Tue Aug 16 21:48:25 EDT 2016
Hi Evan,
If you are using VTK 6.1 or later, you should be able to use that method
from Python. When a method asks for a pointer to int, float, double, etc.,
pass a Python container. A python list is usually a good choice.
The best way to check if a method is available is with the Python help()
function:
help(vtk.vtkPolygon.PointInPolygon)
Help on built-in function PointInPolygon:
PointInPolygon(...)
V.PointInPolygon([float, float, float], int, [float, ...], [float,
float, float, float, float, float], [float, float, float])
-> int
C++: static int PointInPolygon(double x[3], int numPts,
double *pts, double bounds[6], double n[3])
Determine whether point is inside polygon. Function uses
ray-casting to determine if point is inside polygon. Works for
arbitrary polygon shape (e.g., non-convex). Returns 0 if point is
not in polygon; 1 if it is. Can also return -1 to indicate
degenerate polygon.
On Tue, Aug 16, 2016 at 3:10 PM, Evan Kao <tossin at gmail.com> wrote:
> Hello all,
>
> I was wondering if there was any way to use class methods that have array
> pointer inputs in Python. For example, I was looking at the
> vtkPolygon.PointInPolygon
> <http://www.vtk.org/doc/nightly/html/classvtkPolygon.html#a02bd9f9ae98053a1923a0231aea12d09>
> () method, which takes an array pointer specifying the points. This C++
> example
> <http://www.vtk.org/Wiki/VTK/Examples/Cxx/Utilities/PointInPolygon>
> suggests getting the pointer by using a vtkPoints->GetVoidPointer()
> method, but that doesn't seem to yield anything usable in Python.
>
> Thanks,
> Evan Kao
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160816/210e5bb5/attachment.html>
More information about the vtkusers
mailing list