[Bug] vtkPlanes: a change to the plane points or normals does not update the clip filters

Aperta Adatta ai principianti
#3,743 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
78/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
javascript
Ambito
backend, testing

Direzione di ricerca

Inizia da Sources/Common/DataModel/Planes/index.js:290, dove vengono esposti punti e normali, e verifica come vtkPlanes segnala il proprio tempo di modifica. La riproduzione nell’issue mostra l’output obsoleto tramite vtkClipPolyData; eseguila dopo aver aggiornato il comportamento di MTime e conferma che xmin after è 0.5. Controlla anche lo stesso comportamento per vtkCutter, che secondo l’issue dipende dal MTime della funzione implicita.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

type: bug 🐞
Bug description

Sources/Common/DataModel/Planes/index.js:290 gives access to points and
normals through macro.setGet. vtkPlanes does not override getMTime.
If you move a plane with a change to these arrays and call their
modified(), the vtkPlanes MTime does not change. vtkClipPolyData and
vtkCutter use only the MTime of the implicit function, so they keep their
old output.

Steps to reproduce
  1. Run this code:
import vtkPoints from '@kitware/vtk.js/Common/Core/Points';
import vtkDataArray from '@kitware/vtk.js/Common/Core/DataArray';
import vtkPlanes from '@kitware/vtk.js/Common/DataModel/Planes';
import vtkPolyData from '@kitware/vtk.js/Common/DataModel/PolyData';
import vtkClipPolyData from '@kitware/vtk.js/Filters/Core/ClipPolyData';

const points = vtkPoints.newInstance();
points.setData(new Float32Array([0, 0, 0]), 3);
const normals = vtkDataArray.newInstance({
  numberOfComponents: 3,
  values: new Float32Array([1, 0, 0]),
});
const planes = vtkPlanes.newInstance();
planes.setPoints(points);
planes.setNormals(normals);

const quad = vtkPolyData.newInstance();
quad.getPoints().setData(
  new Float32Array([-1, -1, 0, 1, -1, 0, 1, 1, 0, -1, 1, 0]),
  3
);
quad.getPolys().setData(new Uint32Array([4, 0, 1, 2, 3]));

const clip = vtkClipPolyData.newInstance({ clipFunction: planes });
clip.setInputData(quad);
console.log('xmin before', clip.getOutputData().getBounds()[0]);

// Move the plane from x = 0 to x = 0.5.
points.setPoint(0, 0.5, 0, 0);
points.modified();

console.log('xmin after', clip.getOutputData().getBounds()[0]);
Detailed Behavior

The output is:

xmin before 0
xmin after 0

A new filter with the plane at x = 0.5 gives xmin 0.5. The old filter does
not execute again.

Expected Behavior

vtkPlanes.getMTime() includes the MTime of the points and the normals. The
filter executes again and xmin after is 0.5.

Environment
  • vtk.js version: master (67328bc3ef)
  • Browsers: Chromium (Playwright, Vitest 5 browser mode)
  • OS: Windows 11
Lingua principale
JavaScript
Stelle
1.5k
Fork
428
Merge medio
5g 9h
PR unite (30g)
22

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di Kitware/vtk-js

Tutte le issue di Kitware/vtk-js

Issue simili

Altre issue su JavaScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.