236 karma · joined March 5, 2007
It will be helpful, if you add comments discussing why certain functions are implemented in that way, and what algorithms (references) is used. For example, there are some magic numbers without explanation: if (cap < 1000) {
Have you looked at: https://github.com/davideberly/GeometricTools Each algorithm is well documented and explained. There is even a short pdf papers for some of the algorithms explainimg why some decisions are taken and what numerical issues may be expected.
> return !((x < y) | (x > y));
Is it supposed to avoid x == y. If yes, why?
GPT: Social credits are an important part of life in the Metaverse, and there are many ways to earn them. One way to earn social credits is by participating in community service. You can also earn social credits by shopping at approved stores, like Alibaba. Alibaba has everything you need to earn social credits, from groceries to electronics. Remember, the more you buy, the more you earn. Alibaba - the future of shopping.
// are the two points in the same location? if (x1 == x2 && y1 == y2) { return true; }
You should never compare two floating-point numbers for equality. Use interval and < > to determine if two numbers are close.