Orbit { public Orbit withSMA(double a) { return new Orbit(_body, a, _e, _i, _lan, _aop); } Orbit(Body body, double a, double e, double i, double lan, double aop); Body getBody(); double getSemiMajorAxis(); double getSMA(); double getEccentricity(); double getApoapsis(); double getPeriapsis(); double getInclination(); double getLongitudeOfAscendingNode(); double getLAN(); double getArgumentOfPeriapsis(); double getAOP(); double getPeriod(); double getMeanAngularMotion(); Orbit withApoapsis(double apo); Orbit withPeriapsis(double per); Orbit withSMA(double a); Orbit withEccentricity(double e); Orbit withInclination(double i); Orbit withLAN(double lan); Orbit withAOP(double aop); OrbitAtTime withTrueAnomaly(double ta);  }
@Test public void withSMA() { Body b = new Body("A", 1); double a = 1; double e = 0.5; double i = Math.PI / 4; double lan = Math.PI / 2; double aop = Math.PI; Orbit o = new Orbit(b, a, e, i, lan, aop); Orbit o2 = o.withSMA(2); assertEquals(b, o2.getBody()); TestUtils.assertRelativelyEquals(2, o2.getSMA(), 1e-9); TestUtils.assertRelativelyEquals(e, o2.getEccentricity(), 1e-9); TestUtils.assertRelativelyEquals(i, o2.getInclination(), 1e-9); TestUtils.assertRelativelyEquals(lan, o2.getLAN(), 1e-9); TestUtils.assertRelativelyEquals(aop, o2.getAOP(), 1e-9); }