lab-cosmo / chemiscope

An interactive structure/property explorer for materials and molecules
http://chemiscope.org
BSD 3-Clause "New" or "Revised" License
121 stars 29 forks source link

Utility functions to draw shapes that visualise tensors and vectors #289

Closed ceriottm closed 11 months ago

ceriottm commented 11 months ago

Added utility functions to visualize positive-definite tensors (polarizability, thermal ellipsoids, ...) as well as vectors (forces, dipoles, ....). The latter required changing (switching off) the centering of the shapes. I think this is better, because you can always center (and add a utility function for that) a custom shape, but you can't draw an off-center shape if vertices get centered automatically.

Also fixed chemiscope.show so it takes a shapes argument.

ceriottm commented 11 months ago

@rosecers I think I addressed all your comments. Nod if you're OK with merging now so we can move on to the next PR!

Luthaf commented 11 months ago

Regarding arrows: should we have these as predefined shape type inside chemiscope? This will save a lot of space by not requiring to store all the vertices/simplices in the file, but instead generate them on the JS side like we do for ellispoids.

ceriottm commented 11 months ago

Regarding arrows: should we have these as predefined shape type inside chemiscope? This will save a lot of space by not requiring to store all the vertices/simplices in the file, but instead generate them on the JS side like we do for ellispoids.

I agree, but I would like to do this as part of a separate PR in which we address the input format too. In the spirit of doing small incremental PRs.

Luthaf commented 11 months ago

I agree, but I would like to do this as part of a separate PR in which we address the input format too. In the spirit of doing small incremental PRs.

This is tracked in #291!