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

オープン 初心者向け
#3,743 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 2 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
78/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
javascript
領域
backend, testing

調査の方向性

点と法線が公開されている Sources/Common/DataModel/Planes/index.js:290 から始め、vtkPlanes が変更時刻をどのように報告するかを調べてください。Issue の再現例では vtkClipPolyData を通じて古い出力が示されています。MTime の動作を更新した後に実行し、xmin after が 0.5 であることを確認してください。また、Issue によると暗黙関数の MTime に依存する vtkCutter についても、同じ動作を確認してください。

索引モデルが issue の本文から書いたものです。

説明

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
主要言語
JavaScript
スター
1.5k
フォーク
428
平均マージ
5日 9時間
マージ済み PR(30日)
22

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

Kitware/vtk-js のほかの issue

Kitware/vtk-js の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。