simularium / simularium-viewer

NPM package to view Simularium trajectories in 3D
Apache License 2.0
2 stars 0 forks source link

add translation and rotation to fiber agents #333

Closed toloudis closed 1 year ago

toloudis commented 1 year ago

Problem

332

Up until now, fibers have been required to put their subpoints into fully transformed world space, and position and rotation required to be 0. However, our updated fiber rendering does now support full transformations.

Solution

Add a code path to actually use agent position and rotation to transform fiber vertices. Also add a simple javascript test simulator to demonstrate translation and rotation.

Type of change

Change summary:

Add transformation to the shader. Add code path to send data in. This required adding a whole new buffer for the rotation data. This could be inefficient if rotations are nearly always 0 - we are just passing around a buffer of 0s and doing a little extra math with them.

Steps to Verify:

Can clone and select the "TEST_SINGLE_FIBER" in the demo viewer.

Screenshots (optional):

https://github.com/simularium/simularium-viewer/assets/2193409/3eae4d6d-529f-4dd6-8f80-fb4f3adbe993

github-actions[bot] commented 1 year ago

jest coverage report ๐Ÿงช

Total coverage

Status Category Percentage Covered / Total
๐Ÿ”ด Statements 40.12% 1962/4890
๐Ÿ”ด Branches 43.82% 819/1869
๐Ÿ”ด Functions 37.22% 405/1088
๐Ÿ”ด Lines 40.37% 1879/4654

Status of coverage: ๐ŸŸข - ok, ๐ŸŸก - slightly more than threshold, ๐Ÿ”ด - under the threshold

Show files with reduced coverage ๐Ÿ”ป ### Reduced coverage | Status | Filename | Statements | Branches | Functions | Lines | | :----: | :------------------------ | :--------- | :------- | :-------- | :------ | | ๐Ÿ”ด | src/visGeometry | 19.88% | 21.73% | 25.19% | 19.89% | | ๐Ÿ”ด | VisAgent.ts | 33.33% | 39.47% | 22.22% | 33.75% | | ๐Ÿ”ด | src/visGeometry/rendering | 41.04% | 65.27% | 32.23% | 41.56% | > Status of coverage: ๐ŸŸข - ok, ๐ŸŸก - slightly more than threshold, ๐Ÿ”ด - under the threshold
ascibisz commented 1 year ago

The shader part is a bit over my head (although based on context clues it looks reasonable), so looks good to me!