/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
struct Derivative {
Derivative() : dp(0.0), dv(0.0) {};
Derivative(double aDp, double aDv) : dp(aDp), dv(aDv) {}; double dp; // dp / delta time = Position double dv; // dv / delta time = Velocity
};
/** * Acceleration must be overridden and return the number of * axis-position-units / second that should be added or removed from the * velocity.
*/ virtualdouble Acceleration(const State& aState) = 0;
private: /** * Duration of fixed delta time step (seconds)
*/ staticconstdouble kFixedTimestep;
/** * 0.0 - 1.0 value indicating progress between current and next simulation * sample. Normalized to units of kFixedTimestep duration.
*/ double mProgress;
/** * Sample of simulation state as it existed * (1.0 - mProgress) * kFixedTimestep seconds in the past.
*/
State mPrevState;
/** * Sample of simulation state as it will be in mProgress * kFixedTimestep * seconds in the future.
*/
State mNextState;
/** * Perform RK4 (Runge-Kutta method) Integration to calculate the next * simulation sample.
*/ void Integrate(double aDeltaTime);
/** * Apply delta velocity and position represented by aDerivative over * aDeltaTime seconds, calculate new acceleration, and return new deltas.
*/
Derivative Evaluate(const State& aInitState, double aDeltaTime, const Derivative& aDerivative);
/** * Helper function for performing linear interpolation (lerp) of double's
*/ staticdouble LinearInterpolate(double aV1, double aV2, double aBlend);
};
} // namespace layers
} // namespace mozilla
#endif
Messung V0.5
¤ Dauer der Verarbeitung: 0.20 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.