@Test public void testGetMinimumDistanceRandom() { for (int i = 0; i < NUMBER_OF_TESTS; i++) { IVector2 initPos = getRandomVector(POS_LIMIT); IVector2 finalPos = getRandomVector(POS_LIMIT); IVector2 initVel = getRandomVector(2.0); IVector2 testPoint = getRandomVector(5.0 * 1e3); BangBangTrajectory2D traj = new BangBangTrajectory2D(initPos, finalPos, initVel, 2.0, 3.0); double dist = traj.getPlanarCurve().getMinimumDistanceToPoint(testPoint); double sampleDist = sampleDistMin(traj, testPoint, 1e-3); assertThat(dist).isCloseTo(sampleDist, within(2.0)); } }
public double getMinimumDistanceToPoint(final IVector2 point) { return getMinimumDistanceToCurve(PlanarCurve.fromPoint(point)); }
PlanarCurve { public double getMinimumDistanceToPoint(final IVector2 point) { return getMinimumDistanceToCurve(PlanarCurve.fromPoint(point)); } }
PlanarCurve { public double getMinimumDistanceToPoint(final IVector2 point) { return getMinimumDistanceToCurve(PlanarCurve.fromPoint(point)); } PlanarCurve(final List<PlanarCurveSegment> segments); }
PlanarCurve { public double getMinimumDistanceToPoint(final IVector2 point) { return getMinimumDistanceToCurve(PlanarCurve.fromPoint(point)); } PlanarCurve(final List<PlanarCurveSegment> segments); List<PlanarCurveSegment> getSegments(); double getTEnd(); static PlanarCurve fromPoint(final IVector2 point); static PlanarCurve fromPositionAndVelocity(final IVector2 pos, final IVector2 vel, final double tEnd); static PlanarCurve fromPositionVelocityAndAcceleration(final IVector2 pos, final IVector2 vel,
			final IVector2 acc, final double tEnd); PlanarCurve restrictToEnd(final double tEnd); PlanarCurve restrictToStart(final double tStart); double getMinimumDistanceToPoint(final IVector2 point); double getMinimumDistanceToCurve(final PlanarCurve curve); List<IVector2> getIntersectionsWithLineSegment(final ILine line); List<IVector2> getIntersectionsWithRectangle(final IRectangle rect); }
PlanarCurve { public double getMinimumDistanceToPoint(final IVector2 point) { return getMinimumDistanceToCurve(PlanarCurve.fromPoint(point)); } PlanarCurve(final List<PlanarCurveSegment> segments); List<PlanarCurveSegment> getSegments(); double getTEnd(); static PlanarCurve fromPoint(final IVector2 point); static PlanarCurve fromPositionAndVelocity(final IVector2 pos, final IVector2 vel, final double tEnd); static PlanarCurve fromPositionVelocityAndAcceleration(final IVector2 pos, final IVector2 vel,
			final IVector2 acc, final double tEnd); PlanarCurve restrictToEnd(final double tEnd); PlanarCurve restrictToStart(final double tStart); double getMinimumDistanceToPoint(final IVector2 point); double getMinimumDistanceToCurve(final PlanarCurve curve); List<IVector2> getIntersectionsWithLineSegment(final ILine line); List<IVector2> getIntersectionsWithRectangle(final IRectangle rect);  }