Optimaze with new mbed os for study
Dependencies: TS_DISCO_F746NG BSP_DISCO_F746NG Graphics
RadarDemo/Target.h@1:5e49b46de1b0, 2016-11-04 (annotated)
- Committer:
- karpent
- Date:
- Fri Nov 04 17:10:50 2016 +0000
- Revision:
- 1:5e49b46de1b0
- Parent:
- 0:d8b9955d2b36
- Child:
- 2:8db224cc1fcb
Graphics folder published as a library, minor comments update.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
karpent | 1:5e49b46de1b0 | 1 | /* |
karpent | 1:5e49b46de1b0 | 2 | Target.h - Simple simulation of radar target. |
karpent | 1:5e49b46de1b0 | 3 | |
karpent | 1:5e49b46de1b0 | 4 | Copyright(c) 2016 karpent at gmail.com, MIT License |
karpent | 1:5e49b46de1b0 | 5 | |
karpent | 1:5e49b46de1b0 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files(the "Software"), |
karpent | 1:5e49b46de1b0 | 7 | to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, |
karpent | 1:5e49b46de1b0 | 8 | and / or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions : |
karpent | 1:5e49b46de1b0 | 9 | |
karpent | 1:5e49b46de1b0 | 10 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. |
karpent | 1:5e49b46de1b0 | 11 | |
karpent | 1:5e49b46de1b0 | 12 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
karpent | 1:5e49b46de1b0 | 13 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR |
karpent | 1:5e49b46de1b0 | 14 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR |
karpent | 1:5e49b46de1b0 | 15 | THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
karpent | 1:5e49b46de1b0 | 16 | */ |
karpent | 0:d8b9955d2b36 | 17 | |
karpent | 0:d8b9955d2b36 | 18 | #pragma once |
karpent | 0:d8b9955d2b36 | 19 | |
karpent | 0:d8b9955d2b36 | 20 | #include "Location.h" |
karpent | 0:d8b9955d2b36 | 21 | #include "mbed.h" // for uint32_t |
karpent | 0:d8b9955d2b36 | 22 | |
karpent | 0:d8b9955d2b36 | 23 | class Target |
karpent | 0:d8b9955d2b36 | 24 | { |
karpent | 0:d8b9955d2b36 | 25 | public: |
karpent | 0:d8b9955d2b36 | 26 | /// <summary> |
karpent | 0:d8b9955d2b36 | 27 | /// Initializes a new instance of the <see cref="Target"/> class. |
karpent | 0:d8b9955d2b36 | 28 | /// </summary> |
karpent | 0:d8b9955d2b36 | 29 | /// <param name="id">The identifier.</param> |
karpent | 0:d8b9955d2b36 | 30 | /// <param name="speed">The speed.</param> |
karpent | 0:d8b9955d2b36 | 31 | /// <param name="direction">The direction.</param> |
karpent | 0:d8b9955d2b36 | 32 | Target(int id, float speed, float direction); |
karpent | 0:d8b9955d2b36 | 33 | |
karpent | 0:d8b9955d2b36 | 34 | Target(int id, float x, float y, float h, float speed, float direction); |
karpent | 0:d8b9955d2b36 | 35 | |
karpent | 0:d8b9955d2b36 | 36 | /// <summary> |
karpent | 0:d8b9955d2b36 | 37 | /// Sets the location angular. |
karpent | 0:d8b9955d2b36 | 38 | /// </summary> |
karpent | 0:d8b9955d2b36 | 39 | /// <param name="distance">The distance.</param> |
karpent | 0:d8b9955d2b36 | 40 | /// <param name="azimuth">The azimuth.</param> |
karpent | 0:d8b9955d2b36 | 41 | void SetLocationAngular(float distance, float azimuth); |
karpent | 0:d8b9955d2b36 | 42 | |
karpent | 0:d8b9955d2b36 | 43 | /// <summary> |
karpent | 0:d8b9955d2b36 | 44 | /// Gets the location of target. |
karpent | 0:d8b9955d2b36 | 45 | /// </summary> |
karpent | 0:d8b9955d2b36 | 46 | /// <returns>Target location</returns> |
karpent | 0:d8b9955d2b36 | 47 | Location GetLocation(); |
karpent | 0:d8b9955d2b36 | 48 | |
karpent | 0:d8b9955d2b36 | 49 | /// <summary> |
karpent | 0:d8b9955d2b36 | 50 | /// Sets target location. |
karpent | 0:d8b9955d2b36 | 51 | /// </summary> |
karpent | 0:d8b9955d2b36 | 52 | /// <param name="x">x value.</param> |
karpent | 0:d8b9955d2b36 | 53 | /// <param name="y">y value.</param> |
karpent | 0:d8b9955d2b36 | 54 | void SetLocation(float x, float y); |
karpent | 0:d8b9955d2b36 | 55 | |
karpent | 0:d8b9955d2b36 | 56 | /// <summary> |
karpent | 0:d8b9955d2b36 | 57 | /// Update target location for the specified time in miliseconds. |
karpent | 0:d8b9955d2b36 | 58 | /// </summary> |
karpent | 0:d8b9955d2b36 | 59 | /// <param name="currentTime">The current time.</param> |
karpent | 0:d8b9955d2b36 | 60 | void UpdateLocationForTime(uint32_t currentTime); |
karpent | 0:d8b9955d2b36 | 61 | |
karpent | 0:d8b9955d2b36 | 62 | float GetX(); |
karpent | 0:d8b9955d2b36 | 63 | float GetY(); |
karpent | 0:d8b9955d2b36 | 64 | float GetAzimuth(); |
karpent | 0:d8b9955d2b36 | 65 | float GetDistance(); |
karpent | 0:d8b9955d2b36 | 66 | |
karpent | 0:d8b9955d2b36 | 67 | float GetSpeed(); |
karpent | 0:d8b9955d2b36 | 68 | float GetDirection(); |
karpent | 0:d8b9955d2b36 | 69 | int GetType(); |
karpent | 0:d8b9955d2b36 | 70 | |
karpent | 0:d8b9955d2b36 | 71 | int Id; |
karpent | 0:d8b9955d2b36 | 72 | |
karpent | 0:d8b9955d2b36 | 73 | protected: |
karpent | 0:d8b9955d2b36 | 74 | Location _location; |
karpent | 0:d8b9955d2b36 | 75 | float _speed; |
karpent | 0:d8b9955d2b36 | 76 | float _direction; |
karpent | 0:d8b9955d2b36 | 77 | int _type; |
karpent | 0:d8b9955d2b36 | 78 | uint32_t _lastUpdateTime; |
karpent | 0:d8b9955d2b36 | 79 | }; |
karpent | 0:d8b9955d2b36 | 80 |