Pint and Coordinate Systems #1705
Replies: 2 comments
-
Hi, I may be missing some key point here, but your pseudocode makes me wonder if you perhaps may be confusing the concepts of "magnitude" , "unit" (and dimensionality). For example: Also, (and again, forgive me if I am missing some key point), I think that what you intend to achieve goes in exactly the opposite direction to what pint is designed to do: pint is designed to allow you to transparently operate with magnitudes in arbitrary units as long as the dimensionality is correct. For example: a = Quantity("3mm") + Quantity("4 inches") ... whereas, AFAICT, your pseudocode would define two 3-dimensional "coordinate systems" defined by composed units (let's call them "1mm,2mm,3mm" and "3mm,4mm,5mm") in a way that points defined in one of the units would be considered as incompatible with points defined in the other units,... even when it turns out that the points in any of the 2 coordinate systems could be trivially converted into the other coordinate system, since both are essentially 3-dimensional length-length-length spaces. |
Beta Was this translation helpful? Give feedback.
-
Yes, I think pint should not know anything about coordinate systems. E.g. sympy contains such classes as in my pseudo code, but I couldn't make it work together with pint objects. For better understanding, here is my major use case: I'm working with coordinates of different systems. It is just a matter of time that I make a mistake and mix the vectors. So what is the solution here? Better naming of variables? point_3d_c1_mm? At least, the "mm" can be removed from the name when pint is used. |
Beta Was this translation helpful? Give feedback.
-
Hi! I'm searching for a library which make it possible to keep pint quantities as vectors (2D, 3D) and assign them to certain coordinate systems.
My first target would be to just assign those vectors to a certain system and receive an exception if I operate with vectors of different systems (similar to pint's exception when I try to operate with units in different registries).
The final target, then, would be to create transformations between the system, so that it is possible to also calculate with vectors of different systems.
Has anyone already tried something like this with pint quantities?
A pseudo code example:
Beta Was this translation helpful? Give feedback.
All reactions