Skip to content

Conversation

@jadh4v
Copy link
Collaborator

@jadh4v jadh4v commented Dec 2, 2025

Context

The transformation matrices of each glyph should undergo the same shift-scale transform as the input points array of the Glyph3DMapper. However, this transform was being incorrectly calculated in Glyph3DMapper. This issue was fixed by ensuring that there is a single source (function) for the calculation of the shift-scale matrix (or its inversion).

Results

The glyphs are now again visible in the ResliceCursorWidget example.
image

Changes

  • Documentation and TypeScript definitions were updated to match those changes

PR and Code Checklist

  • semantic-release commit messages
  • Run npm run reformat to have correctly formatted code

Testing

  • This change adds or fixes unit tests
  • Tested environment:
    • vtk.js:
    • OS:
    • Browser:

@jadh4v jadh4v requested review from finetjul and sankhesh December 2, 2025 01:34
@jadh4v jadh4v marked this pull request as ready for review December 2, 2025 01:34
Copy link
Collaborator

@sankhesh sankhesh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a bug in Glyph3DMapper where the shift-scale transformation was being incorrectly applied to glyph transformation matrices. The fix consolidates the shift-scale matrix calculation into a single source function and uses proper matrix multiplication instead of component-wise operations.

Key Changes:

  • Replaced incorrect component-wise shift-scale application with proper matrix multiplication in Glyph3DMapper
  • Refactored computeInverseShiftAndScaleMatrix into a shared helper function
  • Fixed GUI controller reference in ResliceCursorWidget example to use lil-gui API

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
Sources/Rendering/OpenGL/Glyph3DMapper/index.js Removed incorrect applyShiftScaleToMat function and replaced with proper matrix multiplication using computeInverseShiftAndScaleMatrix helper
Sources/Rendering/OpenGL/CellArrayBufferObject/helpers.js Added computeInverseShiftAndScaleMatrix as an exported helper function with necessary gl-matrix imports
Sources/Rendering/OpenGL/CellArrayBufferObject/index.js Refactored to import computeInverseShiftAndScaleMatrix from helpers module, removing duplicate implementation
Sources/Widgets/Widgets3D/ResliceCursorWidget/example/index.js Updated GUI controller reference to store and use lil-gui controller object instead of DOM element

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Member

@finetjul finetjul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM
It would have been good to explain in git commit message why the transform was previously incorrect.

Previous function to apply shift and scale transform to the
existing glyph matrix was incorrect
because it did not account for scaling of rotation components.
The glyph matrices can contain rotation components, which
when combined with a shift-scale operation will get affected by
scaling.

It is therefore, better to use proper matrix multiplications
rather than trying to recreate the effect through manipulation of
individual components of a matrix.
@jadh4v jadh4v force-pushed the 3330-bug-glyphmapper-shift-scale branch from fd57b90 to 7a0fea0 Compare December 15, 2025 17:41
@jadh4v jadh4v self-assigned this Dec 15, 2025
@jadh4v
Copy link
Collaborator Author

jadh4v commented Dec 15, 2025

I have updated the relevant commit message explaining what was previously wrong with the matrix calculations. No other changes were made since the last review. I will merge after the pipeline passes.

@jadh4v jadh4v added this pull request to the merge queue Dec 15, 2025
Merged via the queue into Kitware:master with commit 959c7b7 Dec 15, 2025
2 checks passed
@github-actions
Copy link

🎉 This PR is included in version 34.16.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

@github-actions github-actions bot added the released Automated label label Dec 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released Automated label

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] ResliceCursorWidgetExample is obscured by axis colors

3 participants