Skip to content

transform turns vectors and normals; the VTK algorithm the active ones - #345

Open
berkgeveci wants to merge 1 commit into
Kitware:mainfrom
berkgeveci:dataset/transform-vectors
Open

berkgeveci wants to merge 1 commit into
Kitware:mainfrom
berkgeveci:dataset/transform-vectors

Conversation

@berkgeveci

Copy link
Copy Markdown
Collaborator

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: Transform moved 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's vtkTransformFilter transforms 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.
  • The VTK algorithm Transform takes 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 vtkTransformFilter on 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

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

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant