/** * Interpolates between the control points at the given indices. * * @param start * The index of the control point to start from. * @param end * The index of the control point to end at. * @param t * Should be between zero and one. Zero will return point <code>start</code> while one will return * <code>end</code>, a value in between will return an interpolated vector between the two. * @param result * The result of the interpolation will be stored in this vector. * @return The result vector as a convenience. */ public ReadOnlyVector3 interpolate(final int start, final int end, final double t, final Vector3 result) { if (start <= 0) { throw new IllegalArgumentException("start must be > 0! start=" + start); } if (end >= (getControlPointCount() - 1)) { throw new IllegalArgumentException("end must be < " + (getControlPointCount() - 1) + "! end=" + end); } final List<ReadOnlyVector3> points = getControlPoints(); return getSpline().interpolate(points.get(start - 1), points.get(start), points.get(end), points.get(end + 1), t, result); }
/** * Interpolates between the control points at the given indices. * * @param start * The index of the control point to start from. * @param end * The index of the control point to end at. * @param t * Should be between zero and one. Zero will return point <code>start</code> while one will return * <code>end</code>, a value in between will return an interpolated vector between the two. * @param result * The result of the interpolation will be stored in this vector. * @return The result vector as a convenience. */ public ReadOnlyVector3 interpolate(final int start, final int end, final double t, final Vector3 result) { if (start <= 0) { throw new IllegalArgumentException("start must be > 0! start=" + start); } if (end >= (getControlPointCount() - 1)) { throw new IllegalArgumentException("end must be < " + (getControlPointCount() - 1) + "! end=" + end); } final List<ReadOnlyVector3> points = getControlPoints(); return getSpline().interpolate(points.get(start - 1), points.get(start), points.get(end), points.get(end + 1), t, result); }
final int p3 = index + 2; vectors[i] = getSpline().interpolate(controlPoints.get(p0), controlPoints.get(p1), controlPoints.get(p2), controlPoints.get(p3), t);
final int p3 = index + 2; vectors[i] = getSpline().interpolate(controlPoints.get(p0), controlPoints.get(p1), controlPoints.get(p2), controlPoints.get(p3), t);
@Override protected Vector3 interpolateVectors(final ReadOnlyVector3 from, final ReadOnlyVector3 to, final double delta, final Vector3 target) { assert (null != from) : "parameter 'from' can not be null"; assert (null != to) : "parameter 'to' can not be null"; final ReadOnlyVector3 p0 = getControlPointStart(); final ReadOnlyVector3 p3 = getCotnrolPointEnd(); final Spline spline = getCurve().getSpline(); return spline.interpolate(p0, from, to, p3, delta, target); }
@Override protected Vector3 interpolateVectors(final ReadOnlyVector3 from, final ReadOnlyVector3 to, final double delta, final Vector3 target) { assert (null != from) : "parameter 'from' can not be null"; assert (null != to) : "parameter 'to' can not be null"; final ReadOnlyVector3 p0 = getControlPointStart(); final ReadOnlyVector3 p3 = getCotnrolPointEnd(); final Spline spline = getCurve().getSpline(); return spline.interpolate(p0, from, to, p3, delta, target); }