|
| double | IntersectActorWithLine (const double p1[3], const double p2[3], double t1, double t2, double tol, vtkProp3D *prop, vtkMapper *mapper) override |
| |
| bool | IntersectDataSetWithLine (vtkDataSet *dataSet, const double p1[3], const double p2[3], double t1, double t2, double tol, vtkAbstractCellLocator *&locator, vtkIdType &cellId, int &subId, double &tMin, double &pDistMin, double xyz[3], double minPCoords[3]) override |
| |
| double | IntersectWithLine (const double p1[3], const double p2[3], double tol, vtkAssemblyPath *path, vtkProp3D *p, vtkAbstractMapper3D *m) override |
| |
| void | UpdateLocators (vtkRenderer *renderer) |
| |
| | vtkMRMLAccuratePicker () |
| |
| | ~vtkMRMLAccuratePicker () override |
| |
A cell picker that stays fast when large surfaces are shown.
vtkCellPicker tests every cell of every pickable surface unless a spatial locator is registered for that surface's data. Over a large mesh – for example a segmentation closed surface with millions of cells – an un-indexed pick costs O(number of cells), tens to hundreds of milliseconds, which makes per-mouse-move picking (markup dragging, hover read-out) janky.
vtkMRMLAccuratePicker registers and caches a vtkStaticCellLocator for each large, pickable surface in the renderer before every pick, rebuilding a locator only when its surface changes and dropping it when the surface is no longer shown. Picks then become indexed queries. Everything else behaves like vtkCellPicker (same tolerance, picked position, and normal), so it is a drop-in replacement. Picked positions are on the surface of the picked object, whether or not the surface is indexed, unless the ray misses the surface and it is picked within the pick tolerance, for example near its silhouette (see IntersectDataSetWithLine()).
A single instance is meant to be shared per view: vtkMRMLThreeDViewInteractorStyle owns one and exposes it through vtkMRMLInteractionEventData::GetAccuratePicker(), so every widget in the view – and anything else that needs quick localization in world coordinates – reuses one picker and one set of locators.
Definition at line 58 of file vtkMRMLAccuratePicker.h.
| bool vtkMRMLAccuratePicker::IntersectDataSetWithLine |
( |
vtkDataSet * | dataSet, |
|
|
const double | p1[3], |
|
|
const double | p2[3], |
|
|
double | t1, |
|
|
double | t2, |
|
|
double | tol, |
|
|
vtkAbstractCellLocator *& | locator, |
|
|
vtkIdType & | cellId, |
|
|
int & | subId, |
|
|
double & | tMin, |
|
|
double & | pDistMin, |
|
|
double | xyz[3], |
|
|
double | minPCoords[3] ) |
|
overrideprotected |
Pick the cell that the ray hits.
vtkCellPicker picks cells within the pick tolerance of the ray, at the point where the ray crosses the plane of the cell. Over a curved surface, that can be a cell that the ray misses, in front of the cell that it hits, so the picked position is in front of the surface. With a locator, vtkCellPicker picks the first such cell along the ray. Without a locator, it prefers the cell that the ray passes through, but depending on the order of the cells, it can keep a cell that the ray misses. Instead, search for a cell that the ray hits first, and use the pick tolerance only if the ray does not hit the surface (for example, when it passes just outside the silhouette of the surface), with or without a locator.
Vertices and lines can only be picked within the pick tolerance. If the data set has them along with surface or volumetric cells, then both searches are done, and a vertex or line is picked if it is in front of the cell that the ray hits.