5 ms·
The design of that library isn't mine. It's from "Graphic Gems IV". I just rewrote it in C++ as all inline, when I needed it for a physics engine in the 1990s.
by Animats 10y ago
The design of that library isn't mine. It's from "Graphic Gems IV". I just rewrote it in C++ as all inline, when I needed it for a physics engine in the 1990s. It's been used in a few college courses.
In general, overloading operators beyond arithmetic is a bad idea. It just leads to confusion and strange mixed-mode semantics. Python suffers from this. "+" is concatenate for vectors of numbers, but addition for numpy arrays. You can add a vector to a numpy array in Python without getting an error. Guess which action takes place.