The next method I created returns a vector (LVector, because the vector is already something), and it throws an exception. Since the method does not matter, do I always return LVector, or when an exception is thrown, does the method just cancel itself?
public static LVector crossProduct(LVector v1, LVector v2) throws LCalculateException{ if(v1.getLength() != 3|| v2.getLength() != 3) throw new LCalculateException("Invalid vector lengths"); return new LVector(new double[3]{v1.get(1)*v2.get(2)-v1.get(2)*v2.get(1),v1.get(2)*v2.get(0)-v1.get(0)*v2.get(2),v1.get(0)*v2.get(1)-v1.get(1)*v2.get(0)}); }
source share