JuliaGeometry / Meshes.jl

Computational geometry and meshing algorithms in Julia
https://juliageometry.github.io/MeshesDocs/stable
Other
376 stars 80 forks source link

Methods for uconvert #879

Closed VEZY closed 1 month ago

VEZY commented 1 month ago

It would be useful to add methods for converting units of Meshes objects (without changing the CRS). For example, if I want to convert a point with a cartesian CRS from meters to centimeters, I have to do this:

p = Point(1.0, 1.0, 1.0)
Point(uconvert.(u"cm", to(p))...)

But I think we would expect to use this:

p = Point(1.0, 1.0, 1.0)
uconvert(u"cm", p)

Or maybe I missed something.

juliohm commented 1 month ago

We probably need a transform to change the length units inside geometries and domains. It could be something like:

object |> LengthUnit(u"cm")
VEZY commented 1 month ago

That was fast! Thank you!