VTK学习笔记(三十二)vtkOBBTree 获取最小外包框

VTK学习笔记(三十二)vtkOBBTree 获取最小外包框

1、Python vtkOBBTree Exemples

vtkOBBTree is an object to generate oriented bounding box (OBB) trees. An oriented bounding box is a bounding box that does not necessarily line up along coordinate axes. The OBB tree is a hierarchical tree structure of such boxes, where deeper levels of OBB confine smaller regions of space.

To build the OBB, a recursive, top-down process is used. First, the root OBB is constructed by finding the mean and covariance matrix of the cells (and their points) that define the dataset. The eigenvectors of the covariance matrix are extracted, giving a set of three orthogonal vectors that define the tightest-fitting OBB. To create the two children OBB’s, a split plane is found that (approximately) divides the number cells in half. These are then assigned to the children OBB’s. This process then continues until the MaxLevel ivar limits the recursion, or no split plane can be found.

A good reference for OBB-trees is Gottschalk & Manocha in Proceedings of Siggraph `96.

Warning:
Since this algorithms works from a list of cells, the OBB tree will only bound the “geometry” attached to the cells if the convex hull of the cells bounds the geometry.
Long, skinny cells (i.e., cells with poor aspect ratio) may cause unsatisfactory results. This is due to the fact that this is a top-down implementation of the OBB tree, requiring that one or more complete cells are contained in each OBB. This requirement makes it hard to find good split planes during the recursion process. A bottom-up implementation would go a long way to correcting this problem.
vtkOBBTree是一个包围盒的树,它将体的每个cell分割到每个小的包围盒中,由SetNumberOfBuckets确定每个盒中放多少个 Cell。建立一个vtkOBBTree要先设定DataSet,SetDataSet。然后调用BuildLocator。包围盒精细程度由递归深度 (MaxLevel)以及预先设置的NumberOfBuckets决定。
建立起vtkOBBTree之后,可以用vtkOBBTree和直线、三角形甚至是另一个vtkOBBTree做相交检测、运算。

def obb(opts,argv):
	poly = nv.readVTK(argv[0])
	obb = vtk.vtkOBBTree()
	obb.SetMaxLevel(10)
	obb.SetNumberOfCellsPerNode(5)
	obb.AutomaticOn()
	sfilt = vtk.vtkSpatialRepresentationFilter()
	sfilt.SetSpatialRepresentation(obb)
	sfilt.SetInput(poly)
	sfilt.Update()
	nv.writeVTK(argv[1],sfilt.GetOutput())

参考:Python vtkOBBTree Exemples

参考:OBBTreeIntersectWithLine
参考:[算法][包围盒]球,AABB,OBB
参考:OBBTree: A Hierarchical Structure for Rapid Interference Detection
参考:如何获取有向包围盒

2、测试程序

AlignTwoPolyDatas.py

#!/usr/bin/env python
# -*- coding: utf-8 -*-

import vtk


def get_program_parameters():
    import argparse
    description = 'How to align two vtkPolyData\'s.'
    epilogue = '''

    '''
    parser = argparse.ArgumentParser(description=description, epilog=epilogue,
                                     formatter_class=argparse.RawTextHelpFormatter)
    parser.add_argument('src_fn', help='The polydata source file name,e.g. Grey_Nurse_Shark.stl.')
    parser.add_argument('tgt_fn', help='The polydata target file name, e.g. shark.ply.')

    args = parser.parse_args()

    return args.src_fn, args.tgt_fn


def main():
    colors = vtk.vtkNamedColors()

    src_fn, tgt_fn = get_program_parameters()
    print('Loading source:', src_fn)
    sourcePolyData = ReadPolyData(src_fn)
    # Save the source polydata in case the align does not improve
    # segmentation
    originalSourcePolyData = vtk.vtkPolyData()
    originalSourcePolyData.DeepCopy(sourcePolyData)

    print('Loading target:', tgt_fn)
    targetPolyData = ReadPolyData(tgt_fn)

    # If the target orientation is markedly different,
    # you may need to apply a transform to orient the
    # target with the source.
    # For example, when using Grey_Nurse_Shark.stl as the source and
    # greatWhite.stl as the target, you need to uncomment the following
    # two rotations.
    trnf = vtk.vtkTransform()
    # trnf.RotateX(90)
    # trnf.RotateY(-90)
    tpd = vtk.vtkTransformPolyDataFilter()
    tpd.SetTransform(trnf)
    tpd.SetInputData(targetPolyData)
    tpd.Update()

    renderer = vtk.vtkRenderer()
    renderWindow = vtk.vtkRenderWindow()
    renderWindow.AddRenderer(renderer)
    interactor = vtk.vtkRenderWindowInteractor()
    interactor.SetRenderWindow(renderWindow)

    distance = vtk.vtkHausdorffDistancePointSetFilter()
    distance.SetInputData(0, tpd.GetOutput())
    distance.SetInputData(1, sourcePolyData)
    distance.Update()

    distanceBeforeAlign = distance.GetOutput(0).GetFieldData().GetArray('HausdorffDistance').GetComponent(0, 0)

    # Get initial alignment using oriented bounding boxes
    AlignBoundingBoxes(sourcePolyData, tpd.GetOutput())

    distance.SetInputData(0, tpd.GetOutput())
    distance.SetInputData(1, sourcePolyData)
    distance.Modified()
    distance.Update()
    distanceAfterAlign = distance.GetOutput(0).GetFieldData().GetArray('HausdorffDistance').GetComponent(0, 0)

    bestDistance = min(distanceBeforeAlign, distanceAfterAlign)

    if distanceAfterAlign > distanceBeforeAlign:
        sourcePolyData.DeepCopy(originalSourcePolyData)

    # Refine the alignment using IterativeClosestPoint
    icp = vtk.vtkIterativeClosestPointTransform()
    icp.SetSource(sourcePolyData)
    icp.SetTarget(tpd.GetOutput())
    icp.GetLandmarkTransform().SetModeToRigidBody()
    icp.SetMaximumNumberOfLandmarks(100)
    icp.SetMaximumMeanDistance(.00001)
    icp.SetMaximumNumberOfIterations(500)
    icp.CheckMeanDistanceOn()
    icp.StartByMatchingCentroidsOn()
    icp.Update()

    #  print(icp)

    lmTransform = icp.GetLandmarkTransform()
    transform = vtk.vtkTransformPolyDataFilter()
    transform.SetInputData(sourcePolyData)
    transform.SetTransform(lmTransform)
    transform.SetTransform(icp)
    transform.Update()

    distance.SetInputData(0, tpd.GetOutput())
    distance.SetInputData(1, transform.GetOutput())
    distance.Update()

    distanceAfterICP = distance.GetOutput(0).GetFieldData().GetArray('HausdorffDistance').GetComponent(0, 0)

    if distanceAfterICP < bestDistance:
        bestDistance = distanceAfterICP

    print(
        'Distance before, after align, after ICP, min: {:0.5f}, {:0.5f}, {:0.5f}, {:0.5f}'.format(distanceBeforeAlign,
                                                                                                  distanceAfterAlign,
                                                                                                  distanceAfterICP,
                                                                                                  bestDistance))
    # Select
    sourceMapper = vtk.vtkDataSetMapper()
    if bestDistance == distanceBeforeAlign:
        sourceMapper.SetInputData(originalSourcePolyData)
        print('Using original alignment')
    elif bestDistance == distanceAfterAlign:
        sourceMapper.SetInputData(sourcePolyData)
        print('Using alignment by OBB')
    else:
        sourceMapper.SetInputConnection(transform.GetOutputPort())
        print('Using alignment by ICP')
    sourceMapper.ScalarVisibilityOff()

    sourceActor = vtk.vtkActor()
    sourceActor.SetMapper(sourceMapper)
    sourceActor.GetProperty().SetOpacity(.6)
    sourceActor.GetProperty().SetDiffuseColor(
        colors.GetColor3d('White'))
    renderer.AddActor(sourceActor)

    targetMapper = vtk.vtkDataSetMapper()
    targetMapper.SetInputData(tpd.GetOutput())
    targetMapper.ScalarVisibilityOff()

    targetActor = vtk.vtkActor()
    targetActor.SetMapper(targetMapper)
    targetActor.GetProperty().SetDiffuseColor(
        colors.GetColor3d('Tomato'))
    renderer.AddActor(targetActor)

    renderWindow.AddRenderer(renderer)
    renderer.SetBackground(colors.GetColor3d("sea_green_light"))
    renderer.UseHiddenLineRemovalOn()

    renderWindow.SetSize(640, 480)
    renderWindow.Render()
    renderWindow.SetWindowName('AlignTwoPolyDatas')
    renderWindow.Render()
    interactor.Start()


def ReadPolyData(file_name):
    import os
    path, extension = os.path.splitext(file_name)
    extension = extension.lower()
    if extension == ".ply":
        reader = vtk.vtkPLYReader()
        reader.SetFileName(file_name)
        reader.Update()
        poly_data = reader.GetOutput()
    elif extension == ".vtp":
        reader = vtk.vtkXMLpoly_dataReader()
        reader.SetFileName(file_name)
        reader.Update()
        poly_data = reader.GetOutput()
    elif extension == ".obj":
        reader = vtk.vtkOBJReader()
        reader.SetFileName(file_name)
        reader.Update()
        poly_data = reader.GetOutput()
    elif extension == ".stl":
        reader = vtk.vtkSTLReader()
        reader.SetFileName(file_name)
        reader.Update()
        poly_data = reader.GetOutput()
    elif extension == ".vtk":
        reader = vtk.vtkpoly_dataReader()
        reader.SetFileName(file_name)
        reader.Update()
        poly_data = reader.GetOutput()
    elif extension == ".g":
        reader = vtk.vtkBYUReader()
        reader.SetGeometryFileName(file_name)
        reader.Update()
        poly_data = reader.GetOutput()
    else:
        # Return a None if the extension is unknown.
        poly_data = None
    return poly_data


def AlignBoundingBoxes(source, target):
    # Use OBBTree to create an oriented bounding box for target and source
    sourceOBBTree = vtk.vtkOBBTree()
    sourceOBBTree.SetDataSet(source)
    sourceOBBTree.SetMaxLevel(1)
    sourceOBBTree.BuildLocator()

    targetOBBTree = vtk.vtkOBBTree()
    targetOBBTree.SetDataSet(target)
    targetOBBTree.SetMaxLevel(1)
    targetOBBTree.BuildLocator()

    sourceLandmarks = vtk.vtkPolyData()
    sourceOBBTree.GenerateRepresentation(0, sourceLandmarks)

    targetLandmarks = vtk.vtkPolyData()
    targetOBBTree.GenerateRepresentation(0, targetLandmarks)

    lmTransform = vtk.vtkLandmarkTransform()
    lmTransform.SetModeToSimilarity()
    lmTransform.SetTargetLandmarks(targetLandmarks.GetPoints())
    # lmTransformPD = vtk.vtkTransformPolyDataFilter()
    bestDistance = vtk.VTK_DOUBLE_MAX
    bestPoints = vtk.vtkPoints()
    bestDistance = BestBoundingBox(
        "X",
        target,
        source,
        targetLandmarks,
        sourceLandmarks,
        bestDistance,
        bestPoints)
    bestDistance = BestBoundingBox(
        "Y",
        target,
        source,
        targetLandmarks,
        sourceLandmarks,
        bestDistance,
        bestPoints)
    bestDistance = BestBoundingBox(
        "Z",
        target,
        source,
        targetLandmarks,
        sourceLandmarks,
        bestDistance,
        bestPoints)

    lmTransform.SetSourceLandmarks(bestPoints)
    lmTransform.Modified()

    transformPD = vtk.vtkTransformPolyDataFilter()
    transformPD.SetInputData(source)
    transformPD.SetTransform(lmTransform)
    transformPD.Update()

    source.DeepCopy(transformPD.GetOutput())

    return


def BestBoundingBox(axis, target, source, targetLandmarks, sourceLandmarks, bestDistance, bestPoints):
    distance = vtk.vtkHausdorffDistancePointSetFilter()
    testTransform = vtk.vtkTransform()
    testTransformPD = vtk.vtkTransformPolyDataFilter()
    lmTransform = vtk.vtkLandmarkTransform()
    lmTransformPD = vtk.vtkTransformPolyDataFilter()

    lmTransform.SetModeToSimilarity()
    lmTransform.SetTargetLandmarks(targetLandmarks.GetPoints())

    sourceCenter = sourceLandmarks.GetCenter()

    delta = 90.0
    for i in range(0, 4):
        angle = delta * i
        # Rotate about center
        testTransform.Identity()
        testTransform.Translate(sourceCenter[0], sourceCenter[1], sourceCenter[2])
        if axis == "X":
            testTransform.RotateX(angle)
        elif axis == "Y":
            testTransform.RotateY(angle)
        else:
            testTransform.RotateZ(angle)
        testTransform.Translate(-sourceCenter[0], -sourceCenter[1], -sourceCenter[2])

        testTransformPD.SetTransform(testTransform)
        testTransformPD.SetInputData(sourceLandmarks)
        testTransformPD.Update()

        lmTransform.SetSourceLandmarks(testTransformPD.GetOutput().GetPoints())
        lmTransform.Modified()

        lmTransformPD.SetInputData(source)
        lmTransformPD.SetTransform(lmTransform)
        lmTransformPD.Update()

        distance.SetInputData(0, target)
        distance.SetInputData(1, lmTransformPD.GetOutput())
        distance.Update()

        testDistance = distance.GetOutput(0).GetFieldData().GetArray("HausdorffDistance").GetComponent(0, 0)
        if testDistance < bestDistance:
            bestDistance = testDistance
            bestPoints.DeepCopy(testTransformPD.GetOutput().GetPoints())

    return bestDistance


if __name__ == '__main__':
    main()

执行命令:

python ./PolyData/AlignTwoPolyDatas.py ../Testing/Data/thingiverse/Grey_Nurse_Shark.stl ../Testing/Data/shark.ply

显示运行结果:
在这里插入图片描述

3、查看帮助

import vtk
tree = vtk.vtkOBBTree()
help(tree)

输出:

Help on vtkOBBTree object:

class vtkOBBTree(vtkmodules.vtkCommonDataModel.vtkAbstractCellLocator)
 |  vtkOBBTree - generate oriented bounding box (OBB) tree
 |  
 |  Superclass: vtkAbstractCellLocator
 |  
 |  vtkOBBTree is an object to generate oriented bounding box (OBB)
 |  trees. An oriented bounding box is a bounding box that does not
 |  necessarily line up along coordinate axes. The OBB tree is a
 |  hierarchical tree structure of such boxes, where deeper levels of OBB
 |  confine smaller regions of space.
 |  
 |  To build the OBB, a recursive, top-down process is used. First, the
 |  root OBB is constructed by finding the mean and covariance matrix of
 |  the cells (and their points) that define the dataset. The
 |  eigenvectors of the covariance matrix are extracted, giving a set of
 |  three orthogonal vectors that define the tightest-fitting OBB. To
 |  create the two children OBB's, a split plane is found that
 |  (approximately) divides the number cells in half. These are then
 |  assigned to the children OBB's. This process then continues until the
 |  MaxLevel ivar limits the recursion, or no split plane can be found.
 |  
 |  A good reference for OBB-trees is Gottschalk & Manocha in Proceedings
 |  of Siggraph `96.
 |  
 |  @warning
 |  Since this algorithms works from a list of cells, the OBB tree will
 |  only bound the "geometry" attached to the cells if the convex hull of
 |  the cells bounds the geometry.
 |  
 |  @warning
 |  Long, skinny cells (i.e., cells with poor aspect ratio) may cause
 |  unsatisfactory results. This is due to the fact that this is a
 |  top-down implementation of the OBB tree, requiring that one or more
 |  complete cells are contained in each OBB. This requirement makes it
 |  hard to find good split planes during the recursion process. A
 |  bottom-up implementation would go a long way to correcting this
 |  problem.
 |  
 |  @sa
 |  vtkLocator vtkCellLocator vtkPointLocator
 |  
 |  Method resolution order:
 |      vtkOBBTree
 |      vtkmodules.vtkCommonDataModel.vtkAbstractCellLocator
 |      vtkmodules.vtkCommonDataModel.vtkLocator
 |      vtkmodules.vtkCommonCore.vtkObject
 |      vtkmodules.vtkCommonCore.vtkObjectBase
 |      builtins.object
 |  
 |  Methods defined here:
 |  
 |  BuildLocator(...)
 |      V.BuildLocator()
 |      C++: void BuildLocator() override;
 |      
 |      Satisfy locator's abstract interface, see vtkLocator.
 |  
 |  ComputeOBB(...)
 |      V.ComputeOBB(vtkPoints, [float, float, float], [float, float,
 |          float], [float, float, float], [float, float, float], [float,
 |          float, float])
 |      C++: static void ComputeOBB(vtkPoints *pts, double corner[3],
 |          double max[3], double mid[3], double min[3], double size[3])
 |      V.ComputeOBB(vtkDataSet, [float, float, float], [float, float,
 |          float], [float, float, float], [float, float, float], [float,
 |          float, float])
 |      C++: void ComputeOBB(vtkDataSet *input, double corner[3],
 |          double max[3], double mid[3], double min[3], double size[3])
 |      
 |      Compute an OBB from the list of points given. Return the corner
 |      point and the three axes defining the orientation of the OBB.
 |      Also return a sorted list of relative "sizes" of axes for
 |      comparison purposes.
 |  
 |  FreeSearchStructure(...)
 |      V.FreeSearchStructure()
 |      C++: void FreeSearchStructure() override;
 |      
 |      Satisfy locator's abstract interface, see vtkLocator.
 |  
 |  GenerateRepresentation(...)
 |      V.GenerateRepresentation(int, vtkPolyData)
 |      C++: void GenerateRepresentation(int level, vtkPolyData *pd)
 |          override;
 |      
 |      Create polygonal representation for OBB tree at specified level.
 |      If level < 0, then the leaf OBB nodes will be gathered. The
 |      aspect ratio (ar) and line diameter (d) are used to control the
 |      building of the representation. If a OBB node edge ratio's are
 |      greater than ar, then the dimension of the OBB is collapsed
 |      (OBB->plane->line). A "line" OBB will be represented either as
 |      two crossed polygons, or as a line, depending on the relative
 |      diameter of the OBB compared to the diameter (d).
 |  
 |  GetNumberOfGenerationsFromBase(...)
 |      V.GetNumberOfGenerationsFromBase(string) -> int
 |      C++: vtkIdType GetNumberOfGenerationsFromBase(const char *type)
 |          override;
 |      
 |      Standard type and print methods.
 |  
 |  GetNumberOfGenerationsFromBaseType(...)
 |      V.GetNumberOfGenerationsFromBaseType(string) -> int
 |      C++: static vtkIdType GetNumberOfGenerationsFromBaseType(
 |          const char *type)
 |      
 |      Standard type and print methods.
 |  
 |  InsideOrOutside(...)
 |      V.InsideOrOutside((float, float, float)) -> int
 |      C++: int InsideOrOutside(const double point[3])
 |      
 |      Determine whether a point is inside or outside the data used to
 |      build this OBB tree.  The data must be a closed surface
 |      vtkPolyData data set. The return value is +1 if outside, -1 if
 |      inside, and 0 if undecided.
 |  
 |  IntersectWithLine(...)
 |      V.IntersectWithLine((float, float, float), (float, float, float),
 |          vtkPoints, vtkIdList) -> int
 |      C++: int IntersectWithLine(const double a0[3], const double a1[3],
 |           vtkPoints *points, vtkIdList *cellIds) override;
 |      V.IntersectWithLine((float, float, float), (float, float, float),
 |          float, float, [float, float, float], [float, float, float],
 |          int, int, vtkGenericCell) -> int
 |      C++: int IntersectWithLine(const double a0[3], const double a1[3],
 |           double tol, double &t, double x[3], double pcoords[3],
 |          int &subId, vtkIdType &cellId, vtkGenericCell *cell) override;
 |      V.IntersectWithLine((float, float, float), (float, float, float),
 |          float, float, [float, float, float], [float, float, float],
 |          int) -> int
 |      C++: virtual int IntersectWithLine(const double p1[3],
 |          const double p2[3], double tol, double &t, double x[3],
 |          double pcoords[3], int &subId)
 |      V.IntersectWithLine((float, float, float), (float, float, float),
 |          float, float, [float, float, float], [float, float, float],
 |          int, int) -> int
 |      C++: virtual int IntersectWithLine(const double p1[3],
 |          const double p2[3], double tol, double &t, double x[3],
 |          double pcoords[3], int &subId, vtkIdType &cellId)
 |      
 |      Take the passed line segment and intersect it with the data set.
 |      This method assumes that the data set is a vtkPolyData that
 |      describes a closed surface, and the intersection points that are
 |      returned in 'points' alternate between entrance points and exit
 |      points. The return value of the function is 0 if no intersections
 |      were found,
 |      -1 if point 'a0' lies inside the closed surface, or +1 if point
 |         'a0' lies outside the closed surface. Either 'points' or
 |         'cellIds' can be set to nullptr if you don't want to receive
 |         that information.
 |  
 |  IsA(...)
 |      V.IsA(string) -> int
 |      C++: vtkTypeBool IsA(const char *type) override;
 |      
 |      Standard type and print methods.
 |  
 |  IsTypeOf(...)
 |      V.IsTypeOf(string) -> int
 |      C++: static vtkTypeBool IsTypeOf(const char *type)
 |      
 |      Standard type and print methods.
 |  
 |  NewInstance(...)
 |      V.NewInstance() -> vtkOBBTree
 |      C++: vtkOBBTree *NewInstance()
 |      
 |      Standard type and print methods.
 |  
 |  SafeDownCast(...)
 |      V.SafeDownCast(vtkObjectBase) -> vtkOBBTree
 |      C++: static vtkOBBTree *SafeDownCast(vtkObjectBase *o)
 |      
 |      Standard type and print methods.
 |  
 |  __delattr__(self, name, /)
 |      Implement delattr(self, name).
 |  
 |  __getattribute__(self, name, /)
 |      Return getattr(self, name).
 |  
 |  __repr__(self, /)
 |      Return repr(self).
 |  
 |  __setattr__(self, name, value, /)
 |      Implement setattr(self, name, value).
 |  
 |  __str__(self, /)
 |      Return str(self).
 |  
 |  ----------------------------------------------------------------------
 |  Static methods defined here:
 |  
 |  __new__(*args, **kwargs) from builtins.type
 |      Create and return a new object.  See help(type) for accurate signature.
 |  
 |  ----------------------------------------------------------------------
 |  Data descriptors defined here:
 |  
 |  __dict__
 |      Dictionary of attributes set by user.
 |  
 |  __this__
 |      Pointer to the C++ object.
 |  
 |  ----------------------------------------------------------------------
 |  Data and other attributes defined here:
 |  
 |  __vtkname__ = 'vtkOBBTree'
 |  
 |  ----------------------------------------------------------------------
 |  Methods inherited from vtkmodules.vtkCommonDataModel.vtkAbstractCellLocator:
 |  
 |  CacheCellBoundsOff(...)
 |      V.CacheCellBoundsOff()
 |      C++: virtual void CacheCellBoundsOff()
 |      
 |      Boolean controls whether the bounds of each cell are computed
 |      only once and then saved.  Should be 10 to 20% faster if
 |      repeatedly calling any of the Intersect/Find routines and the
 |      extra memory won't cause disk caching (24 extra bytes per cell
 |      are required to save the bounds).
 |  
 |  CacheCellBoundsOn(...)
 |      V.CacheCellBoundsOn()
 |      C++: virtual void CacheCellBoundsOn()
 |      
 |      Boolean controls whether the bounds of each cell are computed
 |      only once and then saved.  Should be 10 to 20% faster if
 |      repeatedly calling any of the Intersect/Find routines and the
 |      extra memory won't cause disk caching (24 extra bytes per cell
 |      are required to save the bounds).
 |  
 |  FindCell(...)
 |      V.FindCell([float, float, float]) -> int
 |      C++: virtual vtkIdType FindCell(double x[3])
 |      V.FindCell([float, float, float], float, vtkGenericCell, [float,
 |          float, float], [float, ...]) -> int
 |      C++: virtual vtkIdType FindCell(double x[3], double tol2,
 |          vtkGenericCell *GenCell, double pcoords[3], double *weights)
 |      
 |      Returns the Id of the cell containing the point, returns -1 if no
 |      cell found. This interface uses a tolerance of zero
 |  
 |  FindCellsAlongLine(...)
 |      V.FindCellsAlongLine((float, float, float), (float, float, float),
 |           float, vtkIdList)
 |      C++: virtual void FindCellsAlongLine(const double p1[3],
 |          const double p2[3], double tolerance, vtkIdList *cells)
 |      
 |      Given a finite line defined by the two points (p1,p2), return the
 |      list of unique cell ids in the buckets containing the line. It is
 |      possible that an empty cell list is returned. The user must
 |      provide the vtkIdList to populate. This method returns data only
 |      after the locator has been built.
 |  
 |  FindCellsWithinBounds(...)
 |      V.FindCellsWithinBounds([float, ...], vtkIdList)
 |      C++: virtual void FindCellsWithinBounds(double *bbox,
 |          vtkIdList *cells)
 |      
 |      Return a list of unique cell ids inside of a given bounding box.
 |      The user must provide the vtkIdList to populate. This method
 |      returns data only after the locator has been built.
 |  
 |  FindClosestPoint(...)
 |      V.FindClosestPoint((float, float, float), [float, float, float],
 |          int, int, float)
 |      C++: virtual void FindClosestPoint(const double x[3],
 |          double closestPoint[3], vtkIdType &cellId, int &subId,
 |          double &dist2)
 |      V.FindClosestPoint((float, float, float), [float, float, float],
 |          vtkGenericCell, int, int, float)
 |      C++: virtual void FindClosestPoint(const double x[3],
 |          double closestPoint[3], vtkGenericCell *cell,
 |          vtkIdType &cellId, int &subId, double &dist2)
 |      
 |      Return the closest point and the cell which is closest to the
 |      point x. The closest point is somewhere on a cell, it need not be
 |      one of the vertices of the cell.
 |  
 |  FindClosestPointWithinRadius(...)
 |      V.FindClosestPointWithinRadius([float, float, float], float,
 |          [float, float, float], int, int, float) -> int
 |      C++: virtual vtkIdType FindClosestPointWithinRadius(double x[3],
 |          double radius, double closestPoint[3], vtkIdType &cellId,
 |          int &subId, double &dist2)
 |      V.FindClosestPointWithinRadius([float, float, float], float,
 |          [float, float, float], vtkGenericCell, int, int, float) -> int
 |      C++: virtual vtkIdType FindClosestPointWithinRadius(double x[3],
 |          double radius, double closestPoint[3], vtkGenericCell *cell,
 |          vtkIdType &cellId, int &subId, double &dist2)
 |      V.FindClosestPointWithinRadius([float, float, float], float,
 |          [float, float, float], vtkGenericCell, int, int, float, int)
 |          -> int
 |      C++: virtual vtkIdType FindClosestPointWithinRadius(double x[3],
 |          double radius, double closestPoint[3], vtkGenericCell *cell,
 |          vtkIdType &cellId, int &subId, double &dist2, int &inside)
 |      
 |      Return the closest point within a specified radius and the cell
 |      which is closest to the point x. The closest point is somewhere
 |      on a cell, it need not be one of the vertices of the cell. This
 |      method returns 1 if a point is found within the specified radius.
 |      If there are no cells within the specified radius, the method
 |      returns 0 and the values of closestPoint, cellId, subId, and
 |      dist2 are undefined.
 |  
 |  GetCacheCellBounds(...)
 |      V.GetCacheCellBounds() -> int
 |      C++: virtual vtkTypeBool GetCacheCellBounds()
 |      
 |      Boolean controls whether the bounds of each cell are computed
 |      only once and then saved.  Should be 10 to 20% faster if
 |      repeatedly calling any of the Intersect/Find routines and the
 |      extra memory won't cause disk caching (24 extra bytes per cell
 |      are required to save the bounds).
 |  
 |  GetLazyEvaluation(...)
 |      V.GetLazyEvaluation() -> int
 |      C++: virtual vtkTypeBool GetLazyEvaluation()
 |      
 |      Most Locators build their search structures during BuildLocator
 |      but some may delay construction until it is actually needed. If
 |      LazyEvaluation is supported, this turns on/off the feature. if
 |      not supported, it is ignored.
 |  
 |  GetNumberOfCellsPerNode(...)
 |      V.GetNumberOfCellsPerNode() -> int
 |      C++: virtual int GetNumberOfCellsPerNode()
 |      
 |      Specify the preferred/maximum number of cells in each
 |      node/bucket. Default 32. Locators generally operate by
 |      subdividing space into smaller regions until the number of cells
 |      in each region (or node) reaches the desired level.
 |  
 |  GetNumberOfCellsPerNodeMaxValue(...)
 |      V.GetNumberOfCellsPerNodeMaxValue() -> int
 |      C++: virtual int GetNumberOfCellsPerNodeMaxValue()
 |      
 |      Specify the preferred/maximum number of cells in each
 |      node/bucket. Default 32. Locators generally operate by
 |      subdividing space into smaller regions until the number of cells
 |      in each region (or node) reaches the desired level.
 |  
 |  GetNumberOfCellsPerNodeMinValue(...)
 |      V.GetNumberOfCellsPerNodeMinValue() -> int
 |      C++: virtual int GetNumberOfCellsPerNodeMinValue()
 |      
 |      Specify the preferred/maximum number of cells in each
 |      node/bucket. Default 32. Locators generally operate by
 |      subdividing space into smaller regions until the number of cells
 |      in each region (or node) reaches the desired level.
 |  
 |  GetRetainCellLists(...)
 |      V.GetRetainCellLists() -> int
 |      C++: virtual vtkTypeBool GetRetainCellLists()
 |      
 |      Boolean controls whether to maintain list of cells in each node.
 |      not applicable to all implementations, but if the locator is
 |      being used as a geometry simplification technique, there is no
 |      need to keep them.
 |  
 |  GetUseExistingSearchStructure(...)
 |      V.GetUseExistingSearchStructure() -> int
 |      C++: virtual vtkTypeBool GetUseExistingSearchStructure()
 |      
 |      Some locators support querying a new dataset without rebuilding
 |      the search structure (typically this may occur when a dataset
 |      changes due to a time update, but is actually the same topology)
 |      Turning on this flag enables some locators to skip the rebuilding
 |      phase
 |  
 |  InsideCellBounds(...)
 |      V.InsideCellBounds([float, float, float], int) -> bool
 |      C++: virtual bool InsideCellBounds(double x[3], vtkIdType cell_ID)
 |      
 |      Quickly test if a point is inside the bounds of a particular
 |      cell. Some locators cache cell bounds and this function can make
 |      use of fast access to the data.
 |  
 |  LazyEvaluationOff(...)
 |      V.LazyEvaluationOff()
 |      C++: virtual void LazyEvaluationOff()
 |      
 |      Most Locators build their search structures during BuildLocator
 |      but some may delay construction until it is actually needed. If
 |      LazyEvaluation is supported, this turns on/off the feature. if
 |      not supported, it is ignored.
 |  
 |  LazyEvaluationOn(...)
 |      V.LazyEvaluationOn()
 |      C++: virtual void LazyEvaluationOn()
 |      
 |      Most Locators build their search structures during BuildLocator
 |      but some may delay construction until it is actually needed. If
 |      LazyEvaluation is supported, this turns on/off the feature. if
 |      not supported, it is ignored.
 |  
 |  RetainCellListsOff(...)
 |      V.RetainCellListsOff()
 |      C++: virtual void RetainCellListsOff()
 |      
 |      Boolean controls whether to maintain list of cells in each node.
 |      not applicable to all implementations, but if the locator is
 |      being used as a geometry simplification technique, there is no
 |      need to keep them.
 |  
 |  RetainCellListsOn(...)
 |      V.RetainCellListsOn()
 |      C++: virtual void RetainCellListsOn()
 |      
 |      Boolean controls whether to maintain list of cells in each node.
 |      not applicable to all implementations, but if the locator is
 |      being used as a geometry simplification technique, there is no
 |      need to keep them.
 |  
 |  SetCacheCellBounds(...)
 |      V.SetCacheCellBounds(int)
 |      C++: virtual void SetCacheCellBounds(vtkTypeBool _arg)
 |      
 |      Boolean controls whether the bounds of each cell are computed
 |      only once and then saved.  Should be 10 to 20% faster if
 |      repeatedly calling any of the Intersect/Find routines and the
 |      extra memory won't cause disk caching (24 extra bytes per cell
 |      are required to save the bounds).
 |  
 |  SetLazyEvaluation(...)
 |      V.SetLazyEvaluation(int)
 |      C++: virtual void SetLazyEvaluation(vtkTypeBool _arg)
 |      
 |      Most Locators build their search structures during BuildLocator
 |      but some may delay construction until it is actually needed. If
 |      LazyEvaluation is supported, this turns on/off the feature. if
 |      not supported, it is ignored.
 |  
 |  SetNumberOfCellsPerNode(...)
 |      V.SetNumberOfCellsPerNode(int)
 |      C++: virtual void SetNumberOfCellsPerNode(int _arg)
 |      
 |      Specify the preferred/maximum number of cells in each
 |      node/bucket. Default 32. Locators generally operate by
 |      subdividing space into smaller regions until the number of cells
 |      in each region (or node) reaches the desired level.
 |  
 |  SetRetainCellLists(...)
 |      V.SetRetainCellLists(int)
 |      C++: virtual void SetRetainCellLists(vtkTypeBool _arg)
 |      
 |      Boolean controls whether to maintain list of cells in each node.
 |      not applicable to all implementations, but if the locator is
 |      being used as a geometry simplification technique, there is no
 |      need to keep them.
 |  
 |  SetUseExistingSearchStructure(...)
 |      V.SetUseExistingSearchStructure(int)
 |      C++: virtual void SetUseExistingSearchStructure(vtkTypeBool _arg)
 |      
 |      Some locators support querying a new dataset without rebuilding
 |      the search structure (typically this may occur when a dataset
 |      changes due to a time update, but is actually the same topology)
 |      Turning on this flag enables some locators to skip the rebuilding
 |      phase
 |  
 |  UseExistingSearchStructureOff(...)
 |      V.UseExistingSearchStructureOff()
 |      C++: virtual void UseExistingSearchStructureOff()
 |      
 |      Some locators support querying a new dataset without rebuilding
 |      the search structure (typically this may occur when a dataset
 |      changes due to a time update, but is actually the same topology)
 |      Turning on this flag enables some locators to skip the rebuilding
 |      phase
 |  
 |  UseExistingSearchStructureOn(...)
 |      V.UseExistingSearchStructureOn()
 |      C++: virtual void UseExistingSearchStructureOn()
 |      
 |      Some locators support querying a new dataset without rebuilding
 |      the search structure (typically this may occur when a dataset
 |      changes due to a time update, but is actually the same topology)
 |      Turning on this flag enables some locators to skip the rebuilding
 |      phase
 |  
 |  ----------------------------------------------------------------------
 |  Methods inherited from vtkmodules.vtkCommonDataModel.vtkLocator:
 |  
 |  AutomaticOff(...)
 |      V.AutomaticOff()
 |      C++: virtual void AutomaticOff()
 |      
 |      Boolean controls whether locator depth/resolution of locator is
 |      computed automatically from average number of entities in bucket.
 |      If not set, there will be an explicit method to control the
 |      construction of the locator (found in the subclass).
 |  
 |  AutomaticOn(...)
 |      V.AutomaticOn()
 |      C++: virtual void AutomaticOn()
 |      
 |      Boolean controls whether locator depth/resolution of locator is
 |      computed automatically from average number of entities in bucket.
 |      If not set, there will be an explicit method to control the
 |      construction of the locator (found in the subclass).
 |  
 |  GetAutomatic(...)
 |      V.GetAutomatic() -> int
 |      C++: virtual vtkTypeBool GetAutomatic()
 |      
 |      Boolean controls whether locator depth/resolution of locator is
 |      computed automatically from average number of entities in bucket.
 |      If not set, there will be an explicit method to control the
 |      construction of the locator (found in the subclass).
 |  
 |  GetBuildTime(...)
 |      V.GetBuildTime() -> int
 |      C++: virtual vtkMTimeType GetBuildTime()
 |      
 |      Return the time of the last data structure build.
 |  
 |  GetDataSet(...)
 |      V.GetDataSet() -> vtkDataSet
 |      C++: virtual vtkDataSet *GetDataSet()
 |      
 |      Build the locator from the points/cells defining this dataset.
 |  
 |  GetLevel(...)
 |      V.GetLevel() -> int
 |      C++: virtual int GetLevel()
 |      
 |      Get the level of the locator (determined automatically if
 |      Automatic is true). The value of this ivar may change each time
 |      the locator is built. Initial value is 8.
 |  
 |  GetMaxLevel(...)
 |      V.GetMaxLevel() -> int
 |      C++: virtual int GetMaxLevel()
 |      
 |      Set the maximum allowable level for the tree. If the Automatic
 |      ivar is off, this will be the target depth of the locator.
 |      Initial value is 8.
 |  
 |  GetMaxLevelMaxValue(...)
 |      V.GetMaxLevelMaxValue() -> int
 |      C++: virtual int GetMaxLevelMaxValue()
 |      
 |      Set the maximum allowable level for the tree. If the Automatic
 |      ivar is off, this will be the target depth of the locator.
 |      Initial value is 8.
 |  
 |  GetMaxLevelMinValue(...)
 |      V.GetMaxLevelMinValue() -> int
 |      C++: virtual int GetMaxLevelMinValue()
 |      
 |      Set the maximum allowable level for the tree. If the Automatic
 |      ivar is off, this will be the target depth of the locator.
 |      Initial value is 8.
 |  
 |  GetTolerance(...)
 |      V.GetTolerance() -> float
 |      C++: virtual double GetTolerance()
 |      
 |      Specify absolute tolerance (in world coordinates) for performing
 |      geometric operations.
 |  
 |  GetToleranceMaxValue(...)
 |      V.GetToleranceMaxValue() -> float
 |      C++: virtual double GetToleranceMaxValue()
 |      
 |      Specify absolute tolerance (in world coordinates) for performing
 |      geometric operations.
 |  
 |  GetToleranceMinValue(...)
 |      V.GetToleranceMinValue() -> float
 |      C++: virtual double GetToleranceMinValue()
 |      
 |      Specify absolute tolerance (in world coordinates) for performing
 |      geometric operations.
 |  
 |  Initialize(...)
 |      V.Initialize()
 |      C++: virtual void Initialize()
 |      
 |      Initialize locator. Frees memory and resets object as
 |      appropriate.
 |  
 |  SetAutomatic(...)
 |      V.SetAutomatic(int)
 |      C++: virtual void SetAutomatic(vtkTypeBool _arg)
 |      
 |      Boolean controls whether locator depth/resolution of locator is
 |      computed automatically from average number of entities in bucket.
 |      If not set, there will be an explicit method to control the
 |      construction of the locator (found in the subclass).
 |  
 |  SetDataSet(...)
 |      V.SetDataSet(vtkDataSet)
 |      C++: virtual void SetDataSet(vtkDataSet *)
 |      
 |      Build the locator from the points/cells defining this dataset.
 |  
 |  SetMaxLevel(...)
 |      V.SetMaxLevel(int)
 |      C++: virtual void SetMaxLevel(int _arg)
 |      
 |      Set the maximum allowable level for the tree. If the Automatic
 |      ivar is off, this will be the target depth of the locator.
 |      Initial value is 8.
 |  
 |  SetTolerance(...)
 |      V.SetTolerance(float)
 |      C++: virtual void SetTolerance(double _arg)
 |      
 |      Specify absolute tolerance (in world coordinates) for performing
 |      geometric operations.
 |  
 |  Update(...)
 |      V.Update()
 |      C++: virtual void Update()
 |      
 |      Cause the locator to rebuild itself if it or its input dataset
 |      has changed.
 |  
 |  ----------------------------------------------------------------------
 |  Methods inherited from vtkmodules.vtkCommonCore.vtkObject:
 |  
 |  AddObserver(...)
 |      V.AddObserver(int, function) -> int
 |      C++: unsigned long AddObserver(const char *event,
 |          vtkCommand *command, float priority=0.0f)
 |      
 |      Add an event callback function(vtkObject, int) for an event type.
 |      Returns a handle that can be used with RemoveEvent(int).
 |  
 |  BreakOnError(...)
 |      V.BreakOnError()
 |      C++: static void BreakOnError()
 |      
 |      This method is called when vtkErrorMacro executes. It allows the
 |      debugger to break on error.
 |  
 |  DebugOff(...)
 |      V.DebugOff()
 |      C++: virtual void DebugOff()
 |      
 |      Turn debugging output off.
 |  
 |  DebugOn(...)
 |      V.DebugOn()
 |      C++: virtual void DebugOn()
 |      
 |      Turn debugging output on.
 |  
 |  GetCommand(...)
 |      V.GetCommand(int) -> vtkCommand
 |      C++: vtkCommand *GetCommand(unsigned long tag)
 |      
 |      Allow people to add/remove/invoke observers (callbacks) to any
 |      VTK object.  This is an implementation of the subject/observer
 |      design pattern. An observer is added by specifying an event to
 |      respond to and a vtkCommand to execute. It returns an unsigned
 |      long tag which can be used later to remove the event or retrieve
 |      the command. When events are invoked, the observers are called in
 |      the order they were added. If a priority value is specified, then
 |      the higher priority commands are called first. A command may set
 |      an abort flag to stop processing of the event. (See vtkCommand.h
 |      for more information.)
 |  
 |  GetDebug(...)
 |      V.GetDebug() -> bool
 |      C++: bool GetDebug()
 |      
 |      Get the value of the debug flag.
 |  
 |  GetGlobalWarningDisplay(...)
 |      V.GetGlobalWarningDisplay() -> int
 |      C++: static int GetGlobalWarningDisplay()
 |      
 |      This is a global flag that controls whether any debug, warning or
 |      error messages are displayed.
 |  
 |  GetMTime(...)
 |      V.GetMTime() -> int
 |      C++: virtual vtkMTimeType GetMTime()
 |      
 |      Return this object's modified time.
 |  
 |  GlobalWarningDisplayOff(...)
 |      V.GlobalWarningDisplayOff()
 |      C++: static void GlobalWarningDisplayOff()
 |      
 |      This is a global flag that controls whether any debug, warning or
 |      error messages are displayed.
 |  
 |  GlobalWarningDisplayOn(...)
 |      V.GlobalWarningDisplayOn()
 |      C++: static void GlobalWarningDisplayOn()
 |      
 |      This is a global flag that controls whether any debug, warning or
 |      error messages are displayed.
 |  
 |  HasObserver(...)
 |      V.HasObserver(int, vtkCommand) -> int
 |      C++: vtkTypeBool HasObserver(unsigned long event, vtkCommand *)
 |      V.HasObserver(string, vtkCommand) -> int
 |      C++: vtkTypeBool HasObserver(const char *event, vtkCommand *)
 |      V.HasObserver(int) -> int
 |      C++: vtkTypeBool HasObserver(unsigned long event)
 |      V.HasObserver(string) -> int
 |      C++: vtkTypeBool HasObserver(const char *event)
 |      
 |      Allow people to add/remove/invoke observers (callbacks) to any
 |      VTK object.  This is an implementation of the subject/observer
 |      design pattern. An observer is added by specifying an event to
 |      respond to and a vtkCommand to execute. It returns an unsigned
 |      long tag which can be used later to remove the event or retrieve
 |      the command. When events are invoked, the observers are called in
 |      the order they were added. If a priority value is specified, then
 |      the higher priority commands are called first. A command may set
 |      an abort flag to stop processing of the event. (See vtkCommand.h
 |      for more information.)
 |  
 |  InvokeEvent(...)
 |      V.InvokeEvent(int, void) -> int
 |      C++: int InvokeEvent(unsigned long event, void *callData)
 |      V.InvokeEvent(string, void) -> int
 |      C++: int InvokeEvent(const char *event, void *callData)
 |      V.InvokeEvent(int) -> int
 |      C++: int InvokeEvent(unsigned long event)
 |      V.InvokeEvent(string) -> int
 |      C++: int InvokeEvent(const char *event)
 |      
 |      This method invokes an event and return whether the event was
 |      aborted or not. If the event was aborted, the return value is 1,
 |      otherwise it is 0.
 |  
 |  Modified(...)
 |      V.Modified()
 |      C++: virtual void Modified()
 |      
 |      Update the modification time for this object. Many filters rely
 |      on the modification time to determine if they need to recompute
 |      their data. The modification time is a unique monotonically
 |      increasing unsigned long integer.
 |  
 |  RemoveAllObservers(...)
 |      V.RemoveAllObservers()
 |      C++: void RemoveAllObservers()
 |  
 |  RemoveObserver(...)
 |      V.RemoveObserver(vtkCommand)
 |      C++: void RemoveObserver(vtkCommand *)
 |      V.RemoveObserver(int)
 |      C++: void RemoveObserver(unsigned long tag)
 |      
 |      Allow people to add/remove/invoke observers (callbacks) to any
 |      VTK object.  This is an implementation of the subject/observer
 |      design pattern. An observer is added by specifying an event to
 |      respond to and a vtkCommand to execute. It returns an unsigned
 |      long tag which can be used later to remove the event or retrieve
 |      the command. When events are invoked, the observers are called in
 |      the order they were added. If a priority value is specified, then
 |      the higher priority commands are called first. A command may set
 |      an abort flag to stop processing of the event. (See vtkCommand.h
 |      for more information.)
 |  
 |  RemoveObservers(...)
 |      V.RemoveObservers(int, vtkCommand)
 |      C++: void RemoveObservers(unsigned long event, vtkCommand *)
 |      V.RemoveObservers(string, vtkCommand)
 |      C++: void RemoveObservers(const char *event, vtkCommand *)
 |      V.RemoveObservers(int)
 |      C++: void RemoveObservers(unsigned long event)
 |      V.RemoveObservers(string)
 |      C++: void RemoveObservers(const char *event)
 |      
 |      Allow people to add/remove/invoke observers (callbacks) to any
 |      VTK object.  This is an implementation of the subject/observer
 |      design pattern. An observer is added by specifying an event to
 |      respond to and a vtkCommand to execute. It returns an unsigned
 |      long tag which can be used later to remove the event or retrieve
 |      the command. When events are invoked, the observers are called in
 |      the order they were added. If a priority value is specified, then
 |      the higher priority commands are called first. A command may set
 |      an abort flag to stop processing of the event. (See vtkCommand.h
 |      for more information.)
 |  
 |  SetDebug(...)
 |      V.SetDebug(bool)
 |      C++: void SetDebug(bool debugFlag)
 |      
 |      Set the value of the debug flag. A true value turns debugging on.
 |  
 |  SetGlobalWarningDisplay(...)
 |      V.SetGlobalWarningDisplay(int)
 |      C++: static void SetGlobalWarningDisplay(int val)
 |      
 |      This is a global flag that controls whether any debug, warning or
 |      error messages are displayed.
 |  
 |  ----------------------------------------------------------------------
 |  Methods inherited from vtkmodules.vtkCommonCore.vtkObjectBase:
 |  
 |  FastDelete(...)
 |      V.FastDelete()
 |      C++: virtual void FastDelete()
 |      
 |      Delete a reference to this object.  This version will not invoke
 |      garbage collection and can potentially leak the object if it is
 |      part of a reference loop.  Use this method only when it is known
 |      that the object has another reference and would not be collected
 |      if a full garbage collection check were done.
 |  
 |  GetAddressAsString(...)
 |      V.GetAddressAsString(string) -> string
 |      C++: const char *GetAddressAsString()
 |      
 |      Get address of C++ object in format 'Addr=%p' after casting to
 |      the specified type.  You can get the same information from o.__this__.
 |  
 |  GetClassName(...)
 |      V.GetClassName() -> string
 |      C++: const char *GetClassName()
 |      
 |      Return the class name as a string.
 |  
 |  GetReferenceCount(...)
 |      V.GetReferenceCount() -> int
 |      C++: int GetReferenceCount()
 |      
 |      Return the current reference count of this object.
 |  
 |  InitializeObjectBase(...)
 |      V.InitializeObjectBase()
 |      C++: void InitializeObjectBase()
 |  
 |  Register(...)
 |      V.Register(vtkObjectBase)
 |      C++: virtual void Register(vtkObjectBase *o)
 |      
 |      Increase the reference count by 1.
 |  
 |  SetReferenceCount(...)
 |      V.SetReferenceCount(int)
 |      C++: void SetReferenceCount(int)
 |      
 |      Sets the reference count. (This is very dangerous, use with
 |      care.)
 |  
 |  UnRegister(...)
 |      V.UnRegister(vtkObjectBase)
 |      C++: virtual void UnRegister(vtkObjectBase *o)
 |      
 |      Decrease the reference count (release by another object). This
 |      has the same effect as invoking Delete() (i.e., it reduces the
 |      reference count by 1).

猜你喜欢

转载自blog.csdn.net/juluwangriyue/article/details/124159882