Repository navigation
transform turns vectors and normals; the VTK algorithm the active ones - #345
Open
berkgeveci wants to merge 1 commit into
Open
berkgeveci wants to merge 1 commit into
berkgeveci wants to merge 1 commit into
Conversation
transform(..., vectors=, normals=) applies the map's linear part to vector fields and its inverse transpose to normals, made unit length again. The VTK algorithm Transform carried the input's vectors and normals as they were, so after a rotation they pointed the old way; it now transforms the active vectors and normals, on points and cells, as vtkTransformFilter does. Found running VTK's Python tests on Tack.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Found by running VTK's own Python tests with Tack's algorithms in place of VTK's filters:
vtkTransformFilter's outputs differed from Tack's on 26 runs, every one in a vector or normal array (MatrixToTransform.py,probeComb.py,reverseNormals.py, ...).The bug:
Transformmoved the points and carried every field as it was, so after a rotation the vectors and normals pointed the old way, and normals lit the moved surface wrongly. VTK'svtkTransformFiltertransforms the active vectors (by the linear part) and normals (by its inverse transpose, normalized).The change:
td.transform(data, matrix, fields=None, vectors=(), normals=()): named 3-vector fields turn with the map's linear part; named normals take its inverse transpose, made unit length again, so they stay normal to the moved surface (a shear tilts a normal the linear part alone would get wrong). Tack keeps no roles, so they are named; nothing changes by default. Normals need an invertible map.Transformtakes the input's active vectors and normals, on points and on cells, by default, as VTK does;vectors=/normals=name others,[]none.Tested: vectors and normals against NumPy under a rotation-and-scale and a shear, the normals checked perpendicular to the moved tangents, other fields untouched, a scalar or a singular map refused; the VTK algorithm against
vtkTransformFilteron a sphere's normals and active vectors (exact). Files touched (transforms, VTK algorithms, origin, devices): 647 passed on the 9.7.1 wheel and on a local VTK master; quick tier 3038 passed.🤖 Generated with Claude Code