Skip to content

Commit

Permalink
Update color handling using wrench index as seed
Browse files Browse the repository at this point in the history
  • Loading branch information
yeshasvitirupachuri committed Apr 15, 2019
1 parent b7d1d38 commit c4da8fb
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions plugins/externalwrench/src/ExternalWrench.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,13 @@ ExternalWrench::ExternalWrench()
void ExternalWrench::setWrenchColor()
{
// Set visual color
std::mt19937 rand_gen(50); //fixed seed
std::mt19937 rand_gen(this->wrenchIndex); //fixed seed based on wrench index
std::uniform_real_distribution<> uni_dis(0.0, 1.0);

for(int i = 1; i <= wrenchIndex; i++)
{
uni_dis(rand_gen);
if (i == wrenchIndex) {
color[0] = uni_dis(rand_gen);
color[1] = uni_dis(rand_gen);
color[2] = uni_dis(rand_gen);
color[3] = uni_dis(rand_gen);
}
}

color[0] = uni_dis(rand_gen);
color[1] = uni_dis(rand_gen);
color[2] = uni_dis(rand_gen);
color[3] = uni_dis(rand_gen);
}

void ExternalWrench::setWrenchIndex(int& index)
Expand Down

0 comments on commit c4da8fb

Please sign in to comment.