#NEWLINE# def pwa_point_in_pointcloud( pcloud , indices , batch_size = None ) : #NEWLINE# #INDENT# '\n    Make sure that the decision of whether a point is inside or outside\n    the PointCloud is exactly the same as how PWA calculates triangle\n    containment. Then, we use the trick of setting the mask to all the\n    points that were NOT outside the triangulation. Otherwise, all points\n    were inside and we just return those as ``True``. In general, points\n    on the boundary are counted as inside the polygon.\n\n    Parameters\n    ----------\n    pcloud : :map:`PointCloud`\n        The pointcloud to use for the containment test.\n    indices : (d, n_dims) `ndarray`\n        The list of pixel indices to test.\n    batch_size : `int` or ``None``, optional\n        See constrain_to_pointcloud for more information about the batch_size\n        parameter.\n\n    Returns\n    -------\n    mask : (d,) `bool ndarray`\n        Whether each pixel index was in inside the convex hull of the\n        pointcloud or not.\n    ' #NEWLINE# from menpo.transform.piecewiseaffine import PiecewiseAffine #NEWLINE# from menpo.transform.piecewiseaffine import TriangleContainmentError #NEWLINE# try : #NEWLINE# #INDENT# pwa = PiecewiseAffine ( pcloud , pcloud ) #NEWLINE# pwa . apply ( indices , batch_size = batch_size ) #NEWLINE# return np . ones ( indices . shape [ 0 ] , dtype = np . bool ) #NEWLINE# #UNINDENT# except TriangleContainmentError as e : #NEWLINE# #INDENT# return ( ~ e . points_outside_source_domain )