![](/media/cache/profiles/68a15b5278e4f7c4c056df9d5f1d3b1f.jpg.50x50_q85.jpg)
just a test
Fork of scoreLight_Advanced by
classRigidScafold.cpp@12:0de9cd2bced5, 2012-04-12 (annotated)
- Committer:
- mbedalvaro
- Date:
- Thu Apr 12 08:38:44 2012 +0000
- Revision:
- 12:0de9cd2bced5
- Parent:
- 7:0df17f3078bc
- Child:
- 30:d8af03f01cd4
1) template class vector works fine. This way, I have more memory (by defining a rigid scafold using unsigned shorts). I can now make an elastic blob of at least 50 points. ; ; To do: double buffering (this will again take memory, but it may be ok becaus...
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mbedalvaro | 0:345b3bc7a0ea | 1 | #include "classRigidScafold.h" |
mbedalvaro | 0:345b3bc7a0ea | 2 | |
mbedalvaro | 0:345b3bc7a0ea | 3 | RigidScafold::RigidScafold() { |
mbedalvaro | 0:345b3bc7a0ea | 4 | } |
mbedalvaro | 0:345b3bc7a0ea | 5 | |
mbedalvaro | 0:345b3bc7a0ea | 6 | RigidScafold::~RigidScafold() { |
mbedalvaro | 0:345b3bc7a0ea | 7 | } |
mbedalvaro | 0:345b3bc7a0ea | 8 | |
mbedalvaro | 0:345b3bc7a0ea | 9 | |
mbedalvaro | 12:0de9cd2bced5 | 10 | void RigidScafold::buildCircularScafold(float _radius, vector2Dd _pos, int _numScafoldPoints) { |
mbedalvaro | 0:345b3bc7a0ea | 11 | scafold.resize(_numScafoldPoints); |
mbedalvaro | 4:f9d364f10335 | 12 | float angInc= 2.0 * PI / _numScafoldPoints; |
mbedalvaro | 4:f9d364f10335 | 13 | float ang=0; |
mbedalvaro | 0:345b3bc7a0ea | 14 | for (int i = 0; i < scafold.size(); i++) { |
mbedalvaro | 12:0de9cd2bced5 | 15 | scafold[i]= vector2Dd( cos(ang)* _radius, sin(ang)* _radius ) + _pos; // note: I cannot do vector2Dd( cos(ang), sin(ang) ) * _radius because vector2Dd would give (0,0) |
mbedalvaro | 4:f9d364f10335 | 16 | ang+=angInc; |
mbedalvaro | 0:345b3bc7a0ea | 17 | } |
mbedalvaro | 0:345b3bc7a0ea | 18 | } |
mbedalvaro | 0:345b3bc7a0ea | 19 | |
mbedalvaro | 12:0de9cd2bced5 | 20 | void RigidScafold::buildLine(float _length, float _angleDeg, vector2Dd _pos, int _numScafoldPoints) { |
mbedalvaro | 4:f9d364f10335 | 21 | scafold.resize(_numScafoldPoints); |
mbedalvaro | 12:0de9cd2bced5 | 22 | vector2Dd auxStep = vector2Dd(_length * cos(_angleDeg/180.0 * PI)/_numScafoldPoints, sin(_length * _angleDeg/180.0 * PI)/_numScafoldPoints ) ; |
mbedalvaro | 4:f9d364f10335 | 23 | for (int i = 0; i < scafold.size(); i++) { |
mbedalvaro | 4:f9d364f10335 | 24 | scafold[i]= auxStep * i + _pos; |
mbedalvaro | 4:f9d364f10335 | 25 | } |
mbedalvaro | 4:f9d364f10335 | 26 | } |
mbedalvaro | 4:f9d364f10335 | 27 | |
mbedalvaro | 0:345b3bc7a0ea | 28 | // Other functions to create letters, text, etc. |
mbedalvaro | 0:345b3bc7a0ea | 29 | // ... TO DO .... |
mbedalvaro | 0:345b3bc7a0ea | 30 | |
mbedalvaro | 0:345b3bc7a0ea | 31 |