public bool getAxisAngle(AwVector axis, ref double theta) { bool result; double inverseOfSinThetaByTwo, thetaExtended; if (AwMath.equivalent(w, (double)1.0)) { theta = 0.0; if (axis.length() < AwMath.kDoubleEpsilon) { axis.set(0.0, 0.0, 1.0); } result = false; } else { thetaExtended = Math.Acos(AwMath.clamp(w, -1.0, 1.0)); theta = thetaExtended * 2.0; inverseOfSinThetaByTwo = 1.0 / Math.Sin(thetaExtended); axis.x = x * inverseOfSinThetaByTwo; axis.y = y * inverseOfSinThetaByTwo; axis.z = z * inverseOfSinThetaByTwo; result = true; } return(result); }
public bool getAxisAngle(AwVector axis, ref double theta) { bool result; double inverseOfSinThetaByTwo, thetaExtended; if (AwMath.equivalent(w, (double) 1.0)) { theta = 0.0; if (axis.length() < AwMath.kDoubleEpsilon) { axis.set(0.0,0.0,1.0); } result = false; } else { thetaExtended = Math.Acos(AwMath.clamp(w,-1.0,1.0)); theta = thetaExtended * 2.0; inverseOfSinThetaByTwo = 1.0 / Math.Sin(thetaExtended); axis.x = x * inverseOfSinThetaByTwo; axis.y = y * inverseOfSinThetaByTwo; axis.z = z * inverseOfSinThetaByTwo; result = true; } return result; }