partial_movement.cpp
Go to the documentation of this file.
1 /*
2 * Copyright 2019 Shadow Robot Company Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the Free
6 * Software Foundation version 2 of the License.
7 *
8 * This program is distributed in the hope that it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License along
14 * with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16 
28 
29 namespace shadowrobot
30 {
32  {}
33 
35  {}
36 
37  double PartialMovement::get_target(double percentage)
38  {
39  if (percentage < 0.0)
40  percentage = 0.0;
41  if (percentage > 1.0)
42  percentage = 1.0;
43 
44  int index = static_cast<int>(steps.size() * static_cast<double>(percentage));
45  return steps[index];
46  }
47 } // namespace shadowrobot
48 
49 /* For the emacs weenies in the crowd.
50 Local Variables:
51  c-basic-offset: 2
52 End:
53 */
double get_target(double percentage)
This is the main class from which all the different types of movement will inherit.
std::vector< double > steps


sr_movements
Author(s): Ugo Cupcic
autogenerated on Fri Mar 11 2022 03:29:39