All methods in Vec3 should clearly state their contracts and enforce their preconditions (throwing exceptions where appropriate). It probably also makes sense to impose a class invariant that all components of all Vec3s must be finite; this can be enforced by checking the constructor arguments and making the class final (or giving it a private default constructor).
All methods in
Vec3
should clearly state their contracts and enforce their preconditions (throwing exceptions where appropriate). It probably also makes sense to impose a class invariant that all components of allVec3
s must be finite; this can be enforced by checking the constructor arguments and making the class final (or giving it a private default constructor).