| 1 |
/********************************************************************** |
| 2 |
|
| 3 |
FILENAME: uiuc_find_positon.cpp |
| 4 |
|
| 5 |
---------------------------------------------------------------------- |
| 6 |
|
| 7 |
DESCRIPTION: Determine the position of a surface/object given the |
| 8 |
command, increment rate, and current position. Outputs |
| 9 |
new position |
| 10 |
|
| 11 |
---------------------------------------------------------------------- |
| 12 |
|
| 13 |
STATUS: alpha version |
| 14 |
|
| 15 |
---------------------------------------------------------------------- |
| 16 |
|
| 17 |
REFERENCES: |
| 18 |
|
| 19 |
---------------------------------------------------------------------- |
| 20 |
|
| 21 |
HISTORY: 03/03/2003 initial release |
| 22 |
|
| 23 |
---------------------------------------------------------------------- |
| 24 |
|
| 25 |
AUTHOR(S): Robert Deters <[email protected]> |
| 26 |
Michael Selig <[email protected]> |
| 27 |
|
| 28 |
---------------------------------------------------------------------- |
| 29 |
|
| 30 |
VARIABLES: |
| 31 |
|
| 32 |
---------------------------------------------------------------------- |
| 33 |
|
| 34 |
INPUTS: command, increment rate, position |
| 35 |
|
| 36 |
---------------------------------------------------------------------- |
| 37 |
|
| 38 |
OUTPUTS: position |
| 39 |
|
| 40 |
---------------------------------------------------------------------- |
| 41 |
|
| 42 |
CALLED BY: uiuc_aerodeflections() |
| 43 |
|
| 44 |
---------------------------------------------------------------------- |
| 45 |
|
| 46 |
CALLS TO: * |
| 47 |
|
| 48 |
---------------------------------------------------------------------- |
| 49 |
|
| 50 |
COPYRIGHT: (C) 2003 by Michael Selig |
| 51 |
|
| 52 |
This program is free software; you can redistribute it and/or |
| 53 |
modify it under the terms of the GNU General Public License |
| 54 |
as published by the Free Software Foundation. |
| 55 |
|
| 56 |
This program is distributed in the hope that it will be useful, |
| 57 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 58 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 59 |
GNU General Public License for more details. |
| 60 |
|
| 61 |
You should have received a copy of the GNU General Public License |
| 62 |
along with this program; if not, write to the Free Software |
| 63 |
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 64 |
|
| 65 |
**********************************************************************/ |
| 66 |
#include "uiuc_find_position.h" |
| 67 |
|
| 68 |
double uiuc_find_position(double command, double increment_per_timestep, |
| 69 |
double position) |
| 70 |
{ |
| 71 |
if (position < command) { |
| 72 |
position += increment_per_timestep; |
| 73 |
if (position > command) |
| 74 |
position = command; |
| 75 |
} |
| 76 |
else if (position > command) { |
| 77 |
position -= increment_per_timestep; |
| 78 |
if (position < command) |
| 79 |
position = command; |
| 80 |
} |
| 81 |
|
| 82 |
return position; |
| 83 |
} |