Example of using "Canvas" form "Graphics" library to display 3D graphics.
Dependencies: BSP_DISCO_F746NG Graphics mbed
HardwareAccess/Angle.h@0:8acbce46eede, 2016-11-06 (annotated)
- Committer:
- karpent
- Date:
- Sun Nov 06 02:14:34 2016 +0000
- Revision:
- 0:8acbce46eede
- Child:
- 1:4a5e329e617b
Initial revision with square 3D model.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
karpent | 0:8acbce46eede | 1 | /* |
karpent | 0:8acbce46eede | 2 | Angle.h - Calculate rotation angle |
karpent | 0:8acbce46eede | 3 | |
karpent | 0:8acbce46eede | 4 | Copyright(c) 2016 karpent at gmail.com, MIT License |
karpent | 0:8acbce46eede | 5 | |
karpent | 0:8acbce46eede | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files(the "Software"), |
karpent | 0:8acbce46eede | 7 | to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, |
karpent | 0:8acbce46eede | 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 | 0:8acbce46eede | 9 | |
karpent | 0:8acbce46eede | 10 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. |
karpent | 0:8acbce46eede | 11 | |
karpent | 0:8acbce46eede | 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 | 0:8acbce46eede | 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 | 0:8acbce46eede | 14 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR |
karpent | 0:8acbce46eede | 15 | THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
karpent | 0:8acbce46eede | 16 | */ |
karpent | 0:8acbce46eede | 17 | |
karpent | 0:8acbce46eede | 18 | #pragma once |
karpent | 0:8acbce46eede | 19 | |
karpent | 0:8acbce46eede | 20 | #define FULL_ANGLE 360.0f |
karpent | 0:8acbce46eede | 21 | |
karpent | 0:8acbce46eede | 22 | typedef enum EAngleDirection { |
karpent | 0:8acbce46eede | 23 | Left = 0, |
karpent | 0:8acbce46eede | 24 | Right = 1 |
karpent | 0:8acbce46eede | 25 | } AngleDirection; |
karpent | 0:8acbce46eede | 26 | |
karpent | 0:8acbce46eede | 27 | |
karpent | 0:8acbce46eede | 28 | /** |
karpent | 0:8acbce46eede | 29 | * @brief Calculate rotation angle. |
karpent | 0:8acbce46eede | 30 | */ |
karpent | 0:8acbce46eede | 31 | class Angle |
karpent | 0:8acbce46eede | 32 | { |
karpent | 0:8acbce46eede | 33 | public : |
karpent | 0:8acbce46eede | 34 | |
karpent | 0:8acbce46eede | 35 | Angle(); |
karpent | 0:8acbce46eede | 36 | |
karpent | 0:8acbce46eede | 37 | float GetAngle(); |
karpent | 0:8acbce46eede | 38 | |
karpent | 0:8acbce46eede | 39 | /// Read the rotation angle from a potentiometer attached to pin A0 |
karpent | 0:8acbce46eede | 40 | float ReadAngle(); |
karpent | 0:8acbce46eede | 41 | |
karpent | 0:8acbce46eede | 42 | protected: |
karpent | 0:8acbce46eede | 43 | /// Rotation angle in degrees, range: 0 - 360 |
karpent | 0:8acbce46eede | 44 | float angle; |
karpent | 0:8acbce46eede | 45 | |
karpent | 0:8acbce46eede | 46 | private: |
karpent | 0:8acbce46eede | 47 | AngleDirection direction; |
karpent | 0:8acbce46eede | 48 | |
karpent | 0:8acbce46eede | 49 | float delta; |
karpent | 0:8acbce46eede | 50 | }; |