/** Test the method mul. */ public void testMul() { for (int i = 0; i < receivers.length; i++) { for (int j = 0; j < receivers.length; j++) { approximatelyEquals( receivers[i].magnitude() * receivers[j].magnitude(), receivers[i].mul(receivers[j]).magnitude()); approximatelyEquals( Polar.standardizeAngle(receivers[i].angle() + receivers[j].angle()), receivers[i].mul(receivers[j]).angle()); } } }
/** Test the method Polar.standardizeAngle. */ public void testStandardizeAngle() { approximatelyEquals(0.0, Polar.standardizeAngle(0.0)); approximatelyEquals(3.0, Polar.standardizeAngle(3.0)); approximatelyEquals(-0.5 * StrictMath.PI, Polar.standardizeAngle(1.5 * StrictMath.PI)); approximatelyEquals(0.5 * StrictMath.PI, Polar.standardizeAngle(-1.5 * StrictMath.PI)); approximatelyEquals(0.5 * StrictMath.PI, Polar.standardizeAngle(6.5 * StrictMath.PI)); approximatelyEquals(0.5 * StrictMath.PI, Polar.standardizeAngle(-7.5 * StrictMath.PI)); }
/** Test the method div. */ public void testDiv() { for (int i = 0; i < receivers.length; i++) { for (int j = 0; j < receivers.length; j++) { if (receivers[j].magnitude() != 0) { approximatelyEquals( receivers[i].magnitude() / receivers[j].magnitude(), receivers[i].div(receivers[j]).magnitude()); approximatelyEquals( Polar.standardizeAngle(receivers[i].angle() - receivers[j].angle()), receivers[i].div(receivers[j]).angle()); } } } }