@Test public void testGetPosByVel() { IVector finalPos = trajectory.getPosByVel(0); double tTotal = trajectory.getTimeByVel(0); double tStep = tTotal / 10; IBallTrajectory traj = trajectory; for (double t = 0; t <= tTotal; t += tStep) { IVector2 posNow = traj.getPosByTime(tStep).getXYVector(); IVector2 velNow = traj.getVelByTime(tStep).multiplyNew(1000.0).getXYVector(); traj = TwoPhaseFixedVelBallTrajectory.fromState(posNow, velNow, params); double tStop = t + traj.getTimeByVel(0) + tStep; assertEquals(tTotal, tStop, 1e-3); IVector finalPosNew = traj.getPosByVel(0); assertTrue(finalPos.isCloseTo(finalPosNew, 1e-3)); } }
public static TwoPhaseFixedVelBallTrajectory fromState(final IVector2 posNow, final IVector2 velNow, final TwoPhaseFixedVelParameters params) { double tSwitch = 0; if (velNow.getLength2() > params.vSwitch) { tSwitch = -(velNow.getLength2() - params.vSwitch) / params.getAccSlide(); } return new TwoPhaseFixedVelBallTrajectory(posNow, velNow, tSwitch, params); }
TwoPhaseFixedVelBallTrajectory extends ATwoPhaseBallTrajectory { public static TwoPhaseFixedVelBallTrajectory fromState(final IVector2 posNow, final IVector2 velNow, final TwoPhaseFixedVelParameters params) { double tSwitch = 0; if (velNow.getLength2() > params.vSwitch) { tSwitch = -(velNow.getLength2() - params.vSwitch) / params.getAccSlide(); } return new TwoPhaseFixedVelBallTrajectory(posNow, velNow, tSwitch, params); } }
TwoPhaseFixedVelBallTrajectory extends ATwoPhaseBallTrajectory { public static TwoPhaseFixedVelBallTrajectory fromState(final IVector2 posNow, final IVector2 velNow, final TwoPhaseFixedVelParameters params) { double tSwitch = 0; if (velNow.getLength2() > params.vSwitch) { tSwitch = -(velNow.getLength2() - params.vSwitch) / params.getAccSlide(); } return new TwoPhaseFixedVelBallTrajectory(posNow, velNow, tSwitch, params); } private  TwoPhaseFixedVelBallTrajectory(final IVector2 kickPos, final IVector2 kickVel, final double tSwitch,
			final TwoPhaseFixedVelParameters params); }
TwoPhaseFixedVelBallTrajectory extends ATwoPhaseBallTrajectory { public static TwoPhaseFixedVelBallTrajectory fromState(final IVector2 posNow, final IVector2 velNow, final TwoPhaseFixedVelParameters params) { double tSwitch = 0; if (velNow.getLength2() > params.vSwitch) { tSwitch = -(velNow.getLength2() - params.vSwitch) / params.getAccSlide(); } return new TwoPhaseFixedVelBallTrajectory(posNow, velNow, tSwitch, params); } private  TwoPhaseFixedVelBallTrajectory(final IVector2 kickPos, final IVector2 kickVel, final double tSwitch,
			final TwoPhaseFixedVelParameters params); static TwoPhaseFixedVelBallTrajectory fromKick(final IVector2 kickPos, final IVector2 kickVel,
			final TwoPhaseFixedVelParameters params); static TwoPhaseFixedVelBallTrajectory fromState(final IVector2 posNow, final IVector2 velNow,
			final TwoPhaseFixedVelParameters params); @Override ABallTrajectory mirrored(); }
TwoPhaseFixedVelBallTrajectory extends ATwoPhaseBallTrajectory { public static TwoPhaseFixedVelBallTrajectory fromState(final IVector2 posNow, final IVector2 velNow, final TwoPhaseFixedVelParameters params) { double tSwitch = 0; if (velNow.getLength2() > params.vSwitch) { tSwitch = -(velNow.getLength2() - params.vSwitch) / params.getAccSlide(); } return new TwoPhaseFixedVelBallTrajectory(posNow, velNow, tSwitch, params); } private  TwoPhaseFixedVelBallTrajectory(final IVector2 kickPos, final IVector2 kickVel, final double tSwitch,
			final TwoPhaseFixedVelParameters params); static TwoPhaseFixedVelBallTrajectory fromKick(final IVector2 kickPos, final IVector2 kickVel,
			final TwoPhaseFixedVelParameters params); static TwoPhaseFixedVelBallTrajectory fromState(final IVector2 posNow, final IVector2 velNow,
			final TwoPhaseFixedVelParameters params); @Override ABallTrajectory mirrored();  }