if (it.hasNext()) { for (int j = 1; j < nbSubSegments; j++) { spline.interpolate((float) j / nbSubSegments, cptCP, temp); array[i] = temp.getX(); i++;
array[lineIndex++] = vector3f.z; for (int j = 1; j < nbSubSegments; ++j) { spline.interpolate((float) j / nbSubSegments, currentControlPoint, temp); array[lineIndex++] = temp.getX(); array[lineIndex++] = temp.getY();
Vector3f interpolationResult = new Vector3f(); for (int i = 0; i < array.length; i += 3) { spline.interpolate(u, 0, interpolationResult); array[i] = interpolationResult.x; array[i + 1] = interpolationResult.y;
/** * interpolate the path giving the time since the beginning and the motionControl * this methods sets the new localTranslation to the spatial of the MotionEvent control. * @param time the time since the animation started * @param control the control over the moving spatial */ public float interpolatePath(float time, MotionEvent control, float tpf) { float traveledDistance = 0; TempVars vars = TempVars.get(); Vector3f temp = vars.vect1; Vector3f tmpVector = vars.vect2; Vector2f v = vars.vect2d; //computing traveled distance according to new time traveledDistance = time * (getLength() / control.getInitialDuration()); //getting waypoint index and current value from new traveled distance v = getWayPointIndexForDistance(traveledDistance,v); //setting values control.setCurrentWayPoint((int) v.x); control.setCurrentValue(v.y); //interpolating new position getSpline().interpolate(control.getCurrentValue(), control.getCurrentWayPoint(), temp); if (control.needsDirection()) { tmpVector.set(temp); control.setDirection(tmpVector.subtractLocal(control.getSpatial().getLocalTranslation()).normalizeLocal()); } checkWayPoint(control, tpf); control.getSpatial().setLocalTranslation(temp); vars.release(); return traveledDistance; }
if (it.hasNext()) { for (int j = 1; j < nbSubSegments; j++) { spline.interpolate((float) j / nbSubSegments, cptCP, temp); array[i] = temp.getX(); i++;
if (it.hasNext()) { for (int j = 1; j < nbSubSegments; j++) { spline.interpolate((float) j / nbSubSegments, cptCP, temp); array[i] = temp.getX(); i++;
array[lineIndex++] = vector3f.z; for (int j = 1; j < nbSubSegments; ++j) { spline.interpolate((float) j / nbSubSegments, currentControlPoint, temp); array[lineIndex++] = temp.getX(); array[lineIndex++] = temp.getY();
array[lineIndex++] = vector3f.z; for (int j = 1; j < nbSubSegments; ++j) { spline.interpolate((float) j / nbSubSegments, currentControlPoint, temp); array[lineIndex++] = temp.getX(); array[lineIndex++] = temp.getY();
Vector3f interpolationResult = new Vector3f(); for (int i = 0; i < array.length; i += 3) { spline.interpolate(u, 0, interpolationResult); array[i] = interpolationResult.x; array[i + 1] = interpolationResult.y;
Vector3f interpolationResult = new Vector3f(); for(int i=0;i<array.length;i+=3) { spline.interpolate(u, 0, interpolationResult); array[i] = interpolationResult.x; array[i + 1] = interpolationResult.y;
/** * interpolate the path giving the time since the beginning and the motionControl * this methods sets the new localTranslation to the spatial of the MotionEvent control. * @param time the time since the animation started * @param control the control over the moving spatial */ public float interpolatePath(float time, MotionEvent control, float tpf) { float traveledDistance = 0; TempVars vars = TempVars.get(); Vector3f temp = vars.vect1; Vector3f tmpVector = vars.vect2; Vector2f v = vars.vect2d; //computing traveled distance according to new time traveledDistance = time * (getLength() / control.getInitialDuration()); //getting waypoint index and current value from new traveled distance v = getWayPointIndexForDistance(traveledDistance,v); //setting values control.setCurrentWayPoint((int) v.x); control.setCurrentValue(v.y); //interpolating new position getSpline().interpolate(control.getCurrentValue(), control.getCurrentWayPoint(), temp); if (control.needsDirection()) { tmpVector.set(temp); control.setDirection(tmpVector.subtractLocal(control.getSpatial().getLocalTranslation()).normalizeLocal()); } checkWayPoint(control, tpf); control.getSpatial().setLocalTranslation(temp); vars.release(); return traveledDistance; }