public static float angleBetween(AsVector3D a, AsVector3D b) { float aLen = a.getLength(); if (epsilonEquals(aLen, 0)) { throw new AsArgumentError(); } float bLen = b.getLength(); if (epsilonEquals(bLen, 0)) { throw new AsArgumentError(); } float dotProd = a.x * b.x + a.y * b.y + a.z * b.z; if (epsilonEquals(dotProd, 0)) { return(0.5f * AsMath.PI); } return(AsMath.acos(dotProd / aLen / bLen)); }