[Bug] vtkImageCPRMapper: setDirectionMatrix always reports a change

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

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

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

評価

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

調査の方向性

Sources/Rendering/Core/ImageCPRMapper/index.jsを267行目で開き、setDirectionMatrixの比較を調べてください。再現手順では、現在の動作を示すためにgetDirectionMatrix()とgetMTime()を使用します。変更されていない行列を渡すとfalseが返り、変更時刻が変わらないことを確認してください。

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

説明

type: bug 🐞
Bug description

Sources/Rendering/Core/ImageCPRMapper/index.js:267 compares the 3x3
direction matrix with mat4.equals, which reads 16 entries. Entries 9 to 15
are undefined on the two sides. A comparison with NaN is always false, so
the two matrices are never equal. The setter always calls modified() and
returns true.

Steps to reproduce
  1. Run this code:
import vtkImageCPRMapper from '@kitware/vtk.js/Rendering/Core/ImageCPRMapper';

const mapper = vtkImageCPRMapper.newInstance();
const current = mapper.getDirectionMatrix();
const mtime = mapper.getMTime();

const changed = mapper.setDirectionMatrix(current);
console.log('changed', changed);
console.log('mtime increased', mapper.getMTime() > mtime);
Detailed Behavior

The output is:

changed true
mtime increased true
Expected Behavior

The setter compares the nine entries. If the matrix does not change, the
setter returns false and does not modify the mapper.

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 を短くまとめたダイジェスト。