PhotonBursted / nu_plugin_vec

A Nushell plugin implementing vector operations
MIT License
2 stars 1 forks source link

Allow a vector's magnitude to be set #23

Open PhotonBursted opened 1 week ago

PhotonBursted commented 1 week ago

Is your feature request related to a problem? Please describe. A vector can be scaled, but its magnitude cannot be set explicitly.

Describe the solution you'd like Either a separate command (vec set-magnitude), or a subcommand (vec magnitude set, for instance), which updates the components of the vector.

Describe alternatives you've considered The effect can be emulated by first normalizing, then scaling the vector with the factor of the desired magnitude. Like other requests, though, this is not quite as readable as having a dedicated operation.

Also, this would give opportunities for optimization:

instead of...