simularium / simulariumio

Python package that converts simulation outputs to the format consumed by the Simularium viewer website
Apache License 2.0
5 stars 3 forks source link

subpoints relative to agent position #169

Closed ascibisz closed 8 months ago

ascibisz commented 8 months ago

Problem

A while ago Dan did some updates to the simularium-viewer for subpoints, allowing the agent position / rotation to actually transform the fiber positioning specified in the subpoints (see here). This PR is applying that to simulariumio's translate filter, so now we'll translate the agent position instead of all the subpoint positions for fibers.

Link to story or ticket

Solution

codecov-commenter commented 8 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (10cbf7f) 93.07% compared to head (c357e3b) 92.99%. Report is 2 commits behind head on main.

:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #169 +/- ## ========================================== - Coverage 93.07% 92.99% -0.09% ========================================== Files 106 106 Lines 4941 4936 -5 ========================================== - Hits 4599 4590 -9 - Misses 342 346 +4 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

blairlyons commented 8 months ago

sorry I just remembered we also should save fibers with the center as the position. This will make it so when you click on the fiber the camera centers around the location of the fiber rather than the origin of the scene.

So for converters that deal with fibers (cellpack, cytosim, medyan, springsalad) or sphere groups (physicell), can you calculate the center of the subpoints in 3D (take mean along each dimension), set that as the agent position, and subtract it from the subpoint positions? lmk if it would help to chat about it

ascibisz commented 8 months ago

sorry I just remembered we also should save fibers with the center as the position. This will make it so when you click on the fiber the camera centers around the location of the fiber rather than the origin of the scene.

So for converters that deal with fibers (cellpack, cytosim, medyan, springsalad) or sphere groups (physicell), can you calculate the center of the subpoints in 3D (take mean along each dimension), set that as the agent position, and subtract it from the subpoint positions? lmk if it would help to chat about it

@blairlyons Ok I have addressed this! The Physicell converter already handled this, since sphere groups subpoints have been relative to agent position from the start, so I didn't need to change anything there :)