Example of using "Canvas" form "Graphics" library to display 3D graphics.
Dependencies: BSP_DISCO_F746NG Graphics mbed
HardwareAccess/Scale.h@2:ef3093a7a43e, 2016-11-11 (annotated)
- Committer:
- karpent
- Date:
- Fri Nov 11 15:30:07 2016 +0000
- Revision:
- 2:ef3093a7a43e
- Parent:
- 0:8acbce46eede
Base Model class improved
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
karpent | 0:8acbce46eede | 1 | /* |
karpent | 0:8acbce46eede | 2 | Scale.h - Calculate model scale |
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 | 2:ef3093a7a43e | 20 | typedef enum EScaleType { |
karpent | 2:ef3093a7a43e | 21 | ScaleFixed = 0, |
karpent | 2:ef3093a7a43e | 22 | ScaleSham = 1, |
karpent | 2:ef3093a7a43e | 23 | ScaleReal = 2 |
karpent | 2:ef3093a7a43e | 24 | } ScaleType; |
karpent | 2:ef3093a7a43e | 25 | |
karpent | 0:8acbce46eede | 26 | /** |
karpent | 0:8acbce46eede | 27 | * @brief Calculate model scale. |
karpent | 0:8acbce46eede | 28 | */ |
karpent | 0:8acbce46eede | 29 | class Scale |
karpent | 0:8acbce46eede | 30 | { |
karpent | 0:8acbce46eede | 31 | public : |
karpent | 0:8acbce46eede | 32 | |
karpent | 0:8acbce46eede | 33 | Scale(); |
karpent | 2:ef3093a7a43e | 34 | |
karpent | 2:ef3093a7a43e | 35 | void SetScale(ScaleType type, float initialValue, float minValue, float maxValue, float delta); |
karpent | 0:8acbce46eede | 36 | |
karpent | 0:8acbce46eede | 37 | float GetScale(); |
karpent | 0:8acbce46eede | 38 | |
karpent | 2:ef3093a7a43e | 39 | protected: |
karpent | 2:ef3093a7a43e | 40 | |
karpent | 0:8acbce46eede | 41 | /// Read model scale from a potentiometer attached to pin A1 |
karpent | 0:8acbce46eede | 42 | float ReadScale(); |
karpent | 0:8acbce46eede | 43 | |
karpent | 0:8acbce46eede | 44 | private: |
karpent | 2:ef3093a7a43e | 45 | |
karpent | 2:ef3093a7a43e | 46 | ScaleType _type; |
karpent | 2:ef3093a7a43e | 47 | |
karpent | 2:ef3093a7a43e | 48 | float _scale; |
karpent | 2:ef3093a7a43e | 49 | |
karpent | 2:ef3093a7a43e | 50 | float _maxScale; |
karpent | 2:ef3093a7a43e | 51 | |
karpent | 2:ef3093a7a43e | 52 | float _minScale; |
karpent | 2:ef3093a7a43e | 53 | |
karpent | 2:ef3093a7a43e | 54 | float _delta; |
karpent | 0:8acbce46eede | 55 | }; |