Alvaro Cassinelli
/
skinGames_forktest
just a test
Fork of scoreLight_Advanced by
Diff: classRigidScafold.cpp
- Revision:
- 4:f9d364f10335
- Parent:
- 3:b44ff6de81bd
- Child:
- 5:73cd58b58f95
--- a/classRigidScafold.cpp Mon Apr 02 05:33:44 2012 +0000 +++ b/classRigidScafold.cpp Wed Apr 04 10:05:25 2012 +0000 @@ -7,18 +7,25 @@ } - void RigidScafold::buildCircularScafold(float _radius, vector2D _pos, vector2D _vel, int _numScafoldPoints) { + void RigidScafold::buildCircularScafold(float _radius, vector2D _pos, int _numScafoldPoints) { scafold.resize(_numScafoldPoints); - radius=_radius; - center=_pos; - speed=_vel; - // NOTE: the scafold itself is centered around (0,0), but has a "center" variable + float angInc= 2.0 * PI / _numScafoldPoints; + float ang=0; for (int i = 0; i < scafold.size(); i++) { - scafold[i].x= (radius+i*40) * cos ( (1.0*i / _numScafoldPoints) * 2 * PI); - scafold[i].y= (radius+i*40) * sin ( (1.0*i / _numScafoldPoints) * 2 * PI); + scafold[i]= vector2D( cos(ang), sin(ang) ) * _radius + _pos; + ang+=angInc; } } + + void RigidScafold::buildLine(float _length, float _angleDeg, vector2D _pos, int _numScafoldPoints) { + scafold.resize(_numScafoldPoints); + vector2D auxStep = vector2D(cos(_angleDeg/180.0 * PI)/_numScafoldPoints, sin(_angleDeg/180.0 * PI)/_numScafoldPoints ) * _length; + for (int i = 0; i < scafold.size(); i++) { + scafold[i]= auxStep * i + _pos; + } +} + // Other functions to create letters, text, etc. // ... TO DO ....