Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed Watchdog SDFileSystem DigoleSerialDisp
Estimation/CartPosition/CartPosition.h@0:a6a169de725f, 2013-05-27 (annotated)
- Committer:
 - shimniok
 - Date:
 - Mon May 27 13:26:03 2013 +0000
 - Revision:
 - 0:a6a169de725f
 - Child:
 - 19:ce7fdade3534
 
Working version with priorities set and update time display
Who changed what in which revision?
| User | Revision | Line number | New contents of line | 
|---|---|---|---|
| shimniok | 0:a6a169de725f | 1 | #ifndef __CARTPOSITION_H | 
| shimniok | 0:a6a169de725f | 2 | #define __CARTPOSITION_H | 
| shimniok | 0:a6a169de725f | 3 | |
| shimniok | 0:a6a169de725f | 4 | /** Geographical position and calculation based on cartesian coordinates | 
| shimniok | 0:a6a169de725f | 5 | */ | 
| shimniok | 0:a6a169de725f | 6 | class CartPosition { | 
| shimniok | 0:a6a169de725f | 7 | public: | 
| shimniok | 0:a6a169de725f | 8 | /** Create a new cartesian coordinate object | 
| shimniok | 0:a6a169de725f | 9 | */ | 
| shimniok | 0:a6a169de725f | 10 | CartPosition(void); | 
| shimniok | 0:a6a169de725f | 11 | /** Create a new cartesian coordinate object | 
| shimniok | 0:a6a169de725f | 12 | * @param x sets x coordinate | 
| shimniok | 0:a6a169de725f | 13 | * @param y sets y coordinate | 
| shimniok | 0:a6a169de725f | 14 | */ | 
| shimniok | 0:a6a169de725f | 15 | CartPosition(float x, float y); | 
| shimniok | 0:a6a169de725f | 16 | /** Sets coordinates for object | 
| shimniok | 0:a6a169de725f | 17 | * @param x sets x coordinate | 
| shimniok | 0:a6a169de725f | 18 | * @param y sets y coordinate | 
| shimniok | 0:a6a169de725f | 19 | */ | 
| shimniok | 0:a6a169de725f | 20 | void set(float x, float y); | 
| shimniok | 0:a6a169de725f | 21 | /** Sets coordinates for object | 
| shimniok | 0:a6a169de725f | 22 | * @param p sets coordinates of this object to that of p | 
| shimniok | 0:a6a169de725f | 23 | */ | 
| shimniok | 0:a6a169de725f | 24 | void set(CartPosition p); | 
| shimniok | 0:a6a169de725f | 25 | /** Computes bearing to a position from this position | 
| shimniok | 0:a6a169de725f | 26 | * @param to is the coordinate to which we're calculating bearing | 
| shimniok | 0:a6a169de725f | 27 | */ | 
| shimniok | 0:a6a169de725f | 28 | float bearingTo(CartPosition to); | 
| shimniok | 0:a6a169de725f | 29 | /** Computes distance to a position from this position | 
| shimniok | 0:a6a169de725f | 30 | * @param to is the coordinate to which we're calculating distance | 
| shimniok | 0:a6a169de725f | 31 | */ | 
| shimniok | 0:a6a169de725f | 32 | float distanceTo(CartPosition to); | 
| shimniok | 0:a6a169de725f | 33 | /** Computes the new coordinates for this object given a bearing and distance | 
| shimniok | 0:a6a169de725f | 34 | * @param bearing is the direction traveled | 
| shimniok | 0:a6a169de725f | 35 | * @distance is the distance traveled | 
| shimniok | 0:a6a169de725f | 36 | */ | 
| shimniok | 0:a6a169de725f | 37 | void move(float bearing, float distance); | 
| shimniok | 0:a6a169de725f | 38 | /** x coordinate of this object */ | 
| shimniok | 0:a6a169de725f | 39 | float _x; | 
| shimniok | 0:a6a169de725f | 40 | /** y coordinate of this object */ | 
| shimniok | 0:a6a169de725f | 41 | float _y; | 
| shimniok | 0:a6a169de725f | 42 | }; | 
| shimniok | 0:a6a169de725f | 43 | #endif |