Example of using "Canvas" form "Graphics" library to display 3D graphics.

Dependencies:   BSP_DISCO_F746NG Graphics mbed

Committer:
karpent
Date:
Thu Nov 10 15:38:50 2016 +0000
Revision:
1:4a5e329e617b
Parent:
0:8acbce46eede
Child:
2:ef3093a7a43e
New models added - Cube and Sphere

Who changed what in which revision?

UserRevisionLine numberNew contents of line
karpent 0:8acbce46eede 1 /*
karpent 1:4a5e329e617b 2 Angle.h - Calculate rotation angle
karpent 0:8acbce46eede 3
karpent 1:4a5e329e617b 4 Copyright(c) 2016 karpent at gmail.com, MIT License
karpent 0:8acbce46eede 5
karpent 1:4a5e329e617b 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:4a5e329e617b 7 to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
karpent 1:4a5e329e617b 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 1:4a5e329e617b 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 1:4a5e329e617b 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:4a5e329e617b 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:4a5e329e617b 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:4a5e329e617b 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 typedef enum EAngleDirection {
karpent 0:8acbce46eede 21 Left = 0,
karpent 0:8acbce46eede 22 Right = 1
karpent 0:8acbce46eede 23 } AngleDirection;
karpent 0:8acbce46eede 24
karpent 0:8acbce46eede 25
karpent 0:8acbce46eede 26 /**
karpent 0:8acbce46eede 27 * @brief Calculate rotation angle.
karpent 1:4a5e329e617b 28 * Use method GetAngle() to get simulated rotation angle.
karpent 1:4a5e329e617b 29 * Use method ReadAngle() if you have additional hadware attached to the board,
karpent 1:4a5e329e617b 30 * it reads the rotation angle from a potentiometer.
karpent 0:8acbce46eede 31 */
karpent 0:8acbce46eede 32 class Angle
karpent 0:8acbce46eede 33 {
karpent 1:4a5e329e617b 34 public:
karpent 0:8acbce46eede 35
karpent 0:8acbce46eede 36 Angle();
karpent 0:8acbce46eede 37
karpent 1:4a5e329e617b 38 /// <summary>
karpent 1:4a5e329e617b 39 /// Gets the simulated angle value in degrees.
karpent 1:4a5e329e617b 40 /// </summary>
karpent 1:4a5e329e617b 41 /// <returns>Angle value in degrees.</returns>
karpent 0:8acbce46eede 42 float GetAngle();
karpent 0:8acbce46eede 43
karpent 1:4a5e329e617b 44 /// <summary>
karpent 1:4a5e329e617b 45 /// Reads the rotation angle from a potentiometer attached to pin A0
karpent 1:4a5e329e617b 46 /// </summary>
karpent 1:4a5e329e617b 47 /// <returns>Angle value in degrees.</returns>
karpent 0:8acbce46eede 48 float ReadAngle();
karpent 0:8acbce46eede 49
karpent 0:8acbce46eede 50 protected:
karpent 1:4a5e329e617b 51 /// <summary>
karpent 0:8acbce46eede 52 /// Rotation angle in degrees, range: 0 - 360
karpent 1:4a5e329e617b 53 /// </summary>
karpent 0:8acbce46eede 54 float angle;
karpent 0:8acbce46eede 55
karpent 0:8acbce46eede 56 private:
karpent 1:4a5e329e617b 57 AngleDirection _direction;
karpent 0:8acbce46eede 58
karpent 1:4a5e329e617b 59 float _delta;
karpent 0:8acbce46eede 60 };