Adding new methods to the default Vector class

We are thinking of adding a bit of customization to the default Vector class to add some extra functionality. We have two changes in mind and wanted to get some feedback before proceeding:

  1. Overload -,+,* operators to help with vector operations. This would need to be within the vector class itself.
  2. Create methods like DotProduct, UnitVector, Norm, etc to perform other standard linear algebra operations. This could be defined in the vector class or an extension class
2 Likes

Hi @GerardTaig - welcome! (if you want to, do Introduce yourself 🙆!)

Sounds like a reasonable thing to do. I’m mostly curious what you’re planning to do with this algebra down the line! We’ll keep an eye out for the PR and we can discuss implementation details there. Regarding 2), I wouldn’t mind having the Dot, Unit, Norm functions in the original class as well to start with.

I’ll leave the implementation pattern up to you and the rest of the people reading this for now - I don’t have much experience in how this kind of functionality should be structured beyond how threejs does it.

1 Like