.. index:: pair: class; EE::Math::Interpolation2d .. _doxid-class_e_e_1_1_math_1_1_interpolation2d: class EE::Math::Interpolation2d =============================== .. toctree:: :hidden: Overview ~~~~~~~~ A waypoint manager, used for movement interpolations. :ref:`More...` .. ref-code-block:: cpp :class: doxyrest-overview-code-block #include class Interpolation2d { public: // typedefs typedef std::function :target:`OnPathEndCallback`; typedef std::function :target:`OnStepCallback`; // construction :target:`Interpolation2d`(); :target:`Interpolation2d`(std::vector<:ref:`Point2d`> points); :target:`~Interpolation2d`(); // methods Interpolation2d& :ref:`add`(const :ref:`Vector2f`& pos, const :ref:`Time`& time = Time::Zero); Interpolation2d& :ref:`edit`(const unsigned int& PointNum, const :ref:`Vector2f`& pos, const :ref:`Time`& time); Interpolation2d& :ref:`erase`(const unsigned int& PointNum); Interpolation2d& :ref:`wait`(const :ref:`Vector2f`& pos, const :ref:`Time`& time); Interpolation2d& :ref:`waitAndAdd`(const :ref:`Vector2f`& pos, const :ref:`Time`& waitTime, const :ref:`Time`& addTime); Interpolation2d& :ref:`start`(); Interpolation2d& :ref:`start`(:ref:`OnPathEndCallback` PathEndCallback, :ref:`OnStepCallback` StepCallback = :ref:`OnStepCallback`()); Interpolation2d& :ref:`stop`(); Interpolation2d& :ref:`setPathEndCallback`(:ref:`OnPathEndCallback` PathEndCallback); Interpolation2d& :ref:`setStepCallback`(:ref:`OnStepCallback` StepCallback); void :ref:`update`(const :ref:`Time`& Elapsed); Interpolation2d& :ref:`reset`(); const :ref:`Vector2f`& :ref:`getPosition`(); bool :ref:`getLoop`() const; Interpolation2d& :ref:`setLoop`(const bool& loop); Interpolation2d& :ref:`clear`(); bool :ref:`ended`() const; Interpolation2d& :ref:`setDuration`(const :ref:`Time`& TotTime); const :ref:`Time`& :ref:`getDuration`() const; :ref:`Point2d`* :ref:`getCurrentActual`() const; :ref:`Point2d`* :ref:`getCurrentNext`() const; const :ref:`Uint32`& :ref:`getCurrentPositionIndex`() const; const std::vector<:ref:`Point2d`>& :ref:`getPoints`() const; std::vector<:ref:`Point2d`> :ref:`getReversePoints`(); Interpolation2d& :ref:`setSpeed`(const :ref:`Float`& speed); const :ref:`Float`& :ref:`getSpeed`() const; const bool& :ref:`isEnabled`() const; Interpolation2d& :ref:`setEnabled`(const bool& enabled); Interpolation2d& :ref:`setType`(:ref:`Ease::Interpolation` InterpolationType); const int& :ref:`getType`() const; :ref:`UintPtr` :target:`getData`() const; void :target:`setData`(const :ref:`UintPtr`& data); :ref:`Float` :ref:`getCurrentProgress`(); :ref:`Float` :ref:`getPartialCurrentProgress`(); }; .. _details-class_e_e_1_1_math_1_1_interpolation2d: Detailed Documentation ~~~~~~~~~~~~~~~~~~~~~~ A waypoint manager, used for movement interpolations. Methods ------- .. index:: pair: function; add .. _doxid-class_e_e_1_1_math_1_1_interpolation2d_1a5a5d97d31c42d41e267bbae92c09d690: .. ref-code-block:: cpp :class: doxyrest-title-code-block Interpolation2d& add(const :ref:`Vector2f`& pos, const :ref:`Time`& time = Time::Zero) Add a new waypoint .. index:: pair: function; edit .. _doxid-class_e_e_1_1_math_1_1_interpolation2d_1a68559c9bca180decde0ee7221cb06ed7: .. ref-code-block:: cpp :class: doxyrest-title-code-block Interpolation2d& edit(const unsigned int& PointNum, const :ref:`Vector2f`& pos, const :ref:`Time`& time) Edit a waypoint .. index:: pair: function; erase .. _doxid-class_e_e_1_1_math_1_1_interpolation2d_1a8cb022a371f67d8f3df9fc550947540c: .. ref-code-block:: cpp :class: doxyrest-title-code-block Interpolation2d& erase(const unsigned int& PointNum) Erase a waypoint .. index:: pair: function; wait .. _doxid-class_e_e_1_1_math_1_1_interpolation2d_1a12bf471f171d9f96c7c3a2881b940424: .. ref-code-block:: cpp :class: doxyrest-title-code-block Interpolation2d& wait(const :ref:`Vector2f`& pos, const :ref:`Time`& time) Same as add( pos, time ).add( pos ); .. index:: pair: function; waitAndAdd .. _doxid-class_e_e_1_1_math_1_1_interpolation2d_1a5b602bc32fab3376b5c20d8727181624: .. ref-code-block:: cpp :class: doxyrest-title-code-block Interpolation2d& waitAndAdd(const :ref:`Vector2f`& pos, const :ref:`Time`& waitTime, const :ref:`Time`& addTime) Same as add( pos, waitTime ).add( pos, addTime ); .. index:: pair: function; start .. _doxid-class_e_e_1_1_math_1_1_interpolation2d_1a2e9abb2af4e376b8d53d26c8d42db8f5: .. ref-code-block:: cpp :class: doxyrest-title-code-block Interpolation2d& start() Start the animation ( will reset the current state, and start from the beginning ) .. index:: pair: function; start .. _doxid-class_e_e_1_1_math_1_1_interpolation2d_1a303812e0df6a555b78bc28a3d30504fb: .. ref-code-block:: cpp :class: doxyrest-title-code-block Interpolation2d& start(:ref:`OnPathEndCallback` PathEndCallback, :ref:`OnStepCallback` StepCallback = :ref:`OnStepCallback`()) Start the animation ( will reset the current state, and start from the beginning ) .. rubric:: Parameters: .. list-table:: :widths: 20 80 * - PathEndCallback - An optional callback fired when the animation ends. * - StepCallback - An optional callback that is fired every time that a step is completed. .. index:: pair: function; stop .. _doxid-class_e_e_1_1_math_1_1_interpolation2d_1a1d299e9999d8a85ac5fb49350628978a: .. ref-code-block:: cpp :class: doxyrest-title-code-block Interpolation2d& stop() Stop the animation ( Enable = false ) .. index:: pair: function; setPathEndCallback .. _doxid-class_e_e_1_1_math_1_1_interpolation2d_1aad3730e58bfc498acdba91f4db4aba6e: .. ref-code-block:: cpp :class: doxyrest-title-code-block Interpolation2d& setPathEndCallback(:ref:`OnPathEndCallback` PathEndCallback) Sets a path end callback .. index:: pair: function; setStepCallback .. _doxid-class_e_e_1_1_math_1_1_interpolation2d_1a500e39502e9d7bb3c5710125d6390292: .. ref-code-block:: cpp :class: doxyrest-title-code-block Interpolation2d& setStepCallback(:ref:`OnStepCallback` StepCallback) Sets a step callback .. index:: pair: function; update .. _doxid-class_e_e_1_1_math_1_1_interpolation2d_1ab2a0c0bdddb14021f13fa24213ca626a: .. ref-code-block:: cpp :class: doxyrest-title-code-block void update(const :ref:`Time`& Elapsed) Update the movement interpolation .. index:: pair: function; reset .. _doxid-class_e_e_1_1_math_1_1_interpolation2d_1a294a4d4666c5ccda490acf603b624dfb: .. ref-code-block:: cpp :class: doxyrest-title-code-block Interpolation2d& reset() Reset the class .. index:: pair: function; getPosition .. _doxid-class_e_e_1_1_math_1_1_interpolation2d_1af60991c8b0364a9b1d348f1c8d6863a7: .. ref-code-block:: cpp :class: doxyrest-title-code-block const :ref:`Vector2f`& getPosition() .. rubric:: Returns: The Current Position .. index:: pair: function; getLoop .. _doxid-class_e_e_1_1_math_1_1_interpolation2d_1a30072b7f42a3f449f0410b5e2c3ed38a: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool getLoop() const .. rubric:: Returns: If movement interpolation is a loop .. index:: pair: function; setLoop .. _doxid-class_e_e_1_1_math_1_1_interpolation2d_1a576ee7a3fc5eb37bb3fb3b63f7aef729: .. ref-code-block:: cpp :class: doxyrest-title-code-block Interpolation2d& setLoop(const bool& loop) Set if loop the movement interpolation .. index:: pair: function; clear .. _doxid-class_e_e_1_1_math_1_1_interpolation2d_1aa9657ffc4a585a97d9dc4664e36e7958: .. ref-code-block:: cpp :class: doxyrest-title-code-block Interpolation2d& clear() Clear all the waypoints .. index:: pair: function; ended .. _doxid-class_e_e_1_1_math_1_1_interpolation2d_1a3e4b2ecb58bd0b21afdfd720440d35df: .. ref-code-block:: cpp :class: doxyrest-title-code-block bool ended() const .. rubric:: Returns: If the animation ended .. index:: pair: function; setDuration .. _doxid-class_e_e_1_1_math_1_1_interpolation2d_1ab0dd3921196f122b7569e15f6ddd55b0: .. ref-code-block:: cpp :class: doxyrest-title-code-block Interpolation2d& setDuration(const :ref:`Time`& TotTime) Instead if setting the time between every waypoing, this set a total time for all the movement interpolation. .. index:: pair: function; getDuration .. _doxid-class_e_e_1_1_math_1_1_interpolation2d_1aef0045843464f161837c07e7d39043b6: .. ref-code-block:: cpp :class: doxyrest-title-code-block const :ref:`Time`& getDuration() const .. rubric:: Returns: The total duration of the interpolation. .. index:: pair: function; getCurrentActual .. _doxid-class_e_e_1_1_math_1_1_interpolation2d_1a15ff47e78a15ea4df075a542a151673a: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`Point2d`* getCurrentActual() const .. rubric:: Returns: The Current Node .. index:: pair: function; getCurrentNext .. _doxid-class_e_e_1_1_math_1_1_interpolation2d_1ad4dbd3460fc09686273d8bf2985f8397: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`Point2d`* getCurrentNext() const .. rubric:: Returns: The Next Node .. index:: pair: function; getCurrentPositionIndex .. _doxid-class_e_e_1_1_math_1_1_interpolation2d_1a29e44202b1cad3c4d7a53a2484e5308c: .. ref-code-block:: cpp :class: doxyrest-title-code-block const :ref:`Uint32`& getCurrentPositionIndex() const .. rubric:: Returns: The Current Position in the vector .. index:: pair: function; getPoints .. _doxid-class_e_e_1_1_math_1_1_interpolation2d_1a4284c7db144817de0d98bbfe943ee7f7: .. ref-code-block:: cpp :class: doxyrest-title-code-block const std::vector<:ref:`Point2d`>& getPoints() const .. rubric:: Returns: the vector of waypoints .. index:: pair: function; getReversePoints .. _doxid-class_e_e_1_1_math_1_1_interpolation2d_1a7e49d9aad369ef89522ca798b3a68688: .. ref-code-block:: cpp :class: doxyrest-title-code-block std::vector<:ref:`Point2d`> getReversePoints() .. rubric:: Returns: the vector of waypoints reversed .. index:: pair: function; setSpeed .. _doxid-class_e_e_1_1_math_1_1_interpolation2d_1a3ed52e625e409e9efb96e7d8957f9bba: .. ref-code-block:: cpp :class: doxyrest-title-code-block Interpolation2d& setSpeed(const :ref:`Float`& speed) Set the current interpolation speed ( This will destroy the time of the interpolation and create one depending on the speed ) ( pixels per second ) .. index:: pair: function; getSpeed .. _doxid-class_e_e_1_1_math_1_1_interpolation2d_1aa802a440775b5ec4d6e15ef0e6680c48: .. ref-code-block:: cpp :class: doxyrest-title-code-block const :ref:`Float`& getSpeed() const Get the current interpolation speed .. index:: pair: function; isEnabled .. _doxid-class_e_e_1_1_math_1_1_interpolation2d_1a5869e87af86c2ef8b6aa25334a4b8b8a: .. ref-code-block:: cpp :class: doxyrest-title-code-block const bool& isEnabled() const .. rubric:: Returns: If enabled .. index:: pair: function; setEnabled .. _doxid-class_e_e_1_1_math_1_1_interpolation2d_1ab77eb85631489aadfa055cf5047b6196: .. ref-code-block:: cpp :class: doxyrest-title-code-block Interpolation2d& setEnabled(const bool& enabled) Set it enabled or not .. index:: pair: function; setType .. _doxid-class_e_e_1_1_math_1_1_interpolation2d_1a6d9962814f05926f683d186cacb83052: .. ref-code-block:: cpp :class: doxyrest-title-code-block Interpolation2d& setType(:ref:`Ease::Interpolation` InterpolationType) Set the type of interpolation to be used .. index:: pair: function; getType .. _doxid-class_e_e_1_1_math_1_1_interpolation2d_1ac83b90f4347e4cdaad0c36b9089f182c: .. ref-code-block:: cpp :class: doxyrest-title-code-block const int& getType() const .. rubric:: Returns: The type of the interpolation .. index:: pair: function; getCurrentProgress .. _doxid-class_e_e_1_1_math_1_1_interpolation2d_1adedba2781021ea9580db7a46661bce16: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`Float` getCurrentProgress() .. rubric:: Returns: The current progress percentage (between 0 and 1) of the complete interpolation. .. index:: pair: function; getPartialCurrentProgress .. _doxid-class_e_e_1_1_math_1_1_interpolation2d_1a82641169187f783b37078385f0db2bb7: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`Float` getPartialCurrentProgress() .. rubric:: Returns: The current progress percentage (between 0 and 1) of the current interpolation. This is the partial progress, not the global of the whole interpolation.