前言:本博文主要研究VTK中点转换到曲面上的应用,相关的接口为vtkPolygonalSurfacePointPlacer,为深入研究将基类vtkPointPlacer开始讲解。主要应用为在PolyData表面进行画线。

vtkPointPlacer
描述:将2D display位置转换为世界坐标的基类。
VTK中的很多情况下都需要将2D显示坐标(由RenderWindowInteractor获取)转换为3D世界坐标。这个类是这个功能的抽象。下面列出了一些子类:
<p>1) vtkFocalPlanePointPlacer:该类将2D显示位置转换为位于焦平面上的世界位置。
<p>2) vtkPolygonalSurfacePointPlacer:将2D显示位置转换为世界位置,以便它们位于一个或多个指定polydata的表面上。
<p>3) vtkImageActorPointPlacer:将2D显示位置转换为位于ImageActor上的世界位置
<p>4) vtkBoundedPlanePointPlacer:将2D显示位置转换为世界位置,以便它们位于一组指定的边界平面内。
<p>5) vtkTerrainDataPointPlacer:将2D显示位置转换为位于高度域上的世界位置。
点放置器提供了一个可扩展的框架来指定对点的约束。方法ComputeWorldPosition, ValidateDisplayPosition和ValidateWorldPosition可以被重写,以指示是否允许世界或显示位置。这些类目前由HandleWidget和ContourWidget使用,以允许在它们的句柄的位置上强制执行各种约束。
  /**
   * Given a renderer and a display position in pixel coordinates,
   * compute the world position and orientation where this point
   * will be placed. This method is typically used by the
   * representation to place the point initially. A return value of 1
   * indicates that constraints of the placer are met.
   */
  virtual int ComputeWorldPosition(
    vtkRenderer* ren, double displayPos[2], double worldPos[3], double worldOrient[9]);
  /**
   * Given a renderer, a display position, and a reference world
   * position, compute the new world position and orientation
   * of this point. This method is typically used by the
   * representation to move the point. A return value of 1 indicates that
   * constraints of the placer are met.
   */
  virtual int ComputeWorldPosition(vtkRenderer* ren, double displayPos[2], double refWorldPos[3],
    double worldPos[3], double worldOrient[9]); 
  /**
   * Given a world position check the validity of this
   * position according to the constraints of the placer.
   */
  virtual int ValidateWorldPosition(double worldPos[3]);
  /**
   * Given a display position, check the validity of this position.
   */
  virtual int ValidateDisplayPosition(vtkRenderer*, double displayPos[2]);
  /**
   * Given a world position and a world orientation,
   * validate it according to the constraints of the placer.
   */
  virtual int ValidateWorldPosition(double worldPos[3], double worldOrient[9]); 
vtkPolyDataPointPlacer
描述:将点放置到Surface上的基类。
  // Descuription:
  // Add an actor (that represents a terrain in a rendererd scene) to the
  // list. Only props in this list are considered by the PointPlacer
  virtual void AddProp(vtkProp*);
  virtual void RemoveViewProp(vtkProp* prop);
  virtual void RemoveAllProps();
  int HasProp(vtkProp*);
  int GetNumberOfProps(); 
vtkPolygonalSurfacePointPlacer
描述:在多边形数据上放置点。


















