Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of scoreLight_Advanced by
classRigidScafold.cpp
00001 #include "classRigidScafold.h" 00002 00003 RigidScafold::RigidScafold() { 00004 } 00005 00006 RigidScafold::~RigidScafold() { 00007 } 00008 00009 00010 void RigidScafold::buildCircularScafold(float _radius, vector2Dd _pos, int _numScafoldPoints) { 00011 sizeScafold=_radius; 00012 centerScafold=_pos; 00013 scafold.resize(_numScafoldPoints); 00014 float angInc= 2.0 * PI / _numScafoldPoints; 00015 float ang=0; 00016 for (int i = 0; i < scafold.size(); i++) { 00017 scafold[i]= vector2Dd( cos(ang)* _radius, sin(ang)* sizeScafold ) + centerScafold; 00018 // note: I cannot do vector2Dd( cos(ang), sin(ang) ) * _radius because vector2Dd would give (0,0) 00019 ang+=angInc; 00020 } 00021 } 00022 00023 // Modifying the scafold (resizing, rotating): 00024 // Note: in case of elastic loop, the mass-loop may be reinitialized or not (if the rigid loop is used as "attractor" only): 00025 00026 void RigidScafold::resizeDimensionScafold(float _newSize) { 00027 resizeFactorDimensionScafold(_newSize/sizeScafold); 00028 sizeScafold=_newSize; 00029 } 00030 00031 void RigidScafold::resizeFactorDimensionScafold(float _factor) { 00032 for (int i = 0; i < scafold.size(); i++) { 00033 scafold[i] = ( scafold[i]-centerScafold)*_factor+centerScafold; 00034 } 00035 sizeScafold*=_factor; 00036 } 00037 00038 void RigidScafold::rotateScafold(float alphadeg) { 00039 // note: rotate around the centerScafold: 00040 for (int i = 0; i < scafold.size(); i++) { 00041 scafold[i]=(scafold[i]-centerScafold).getRotatedRad(alphadeg)+centerScafold; 00042 } 00043 } 00044 00045 void RigidScafold::buildLine(float _length, float _angleDeg, vector2Dd _pos, int _numScafoldPoints) { 00046 scafold.resize(_numScafoldPoints); 00047 vector2Dd auxStep = vector2Dd(_length * cos(_angleDeg/180.0 * PI)/_numScafoldPoints, sin(_length * _angleDeg/180.0 * PI)/_numScafoldPoints ) ; 00048 for (int i = 0; i < scafold.size(); i++) { 00049 scafold[i]= auxStep * i + _pos; 00050 } 00051 } 00052 00053 // Other functions to create letters, text, etc. 00054 // ... TO DO .... 00055 00056
Generated on Tue Jul 12 2022 18:50:26 by
1.7.2
