- improved DrawData()
git-svn-id: http://moon:8086/svn/software/trunk/projects/RBM@552 b431acfa-c32f-4a4a-93f1-934dc6c82436
This commit is contained in:
@@ -233,19 +233,19 @@ RowVectorXd& DrawComponent::getData ()
|
||||
void DrawComponent::DrawData ()
|
||||
{
|
||||
|
||||
RowVectorXd temp = m_data;
|
||||
|
||||
for (int i=0; i < m_width*m_height; i++)
|
||||
double max = m_data.array().abs().maxCoeff();
|
||||
|
||||
if (max < 1.0)
|
||||
{
|
||||
temp[i] = std::min<double>(1.0, (double)temp[i]);
|
||||
temp[i] = std::max<double>(-1.0, (double)temp[i]);
|
||||
max = 1.0;
|
||||
}
|
||||
|
||||
double scale = m_scale/max;
|
||||
|
||||
for (int i=0; i < m_height; i++)
|
||||
{
|
||||
for (int j=0; j < m_width; j++)
|
||||
{
|
||||
m_pG->setColour(Colour(Colours::white).greyLevel(m_offset + m_scale*temp[i*m_width + j]));
|
||||
m_pG->setColour(Colour(Colours::white).greyLevel(m_offset + scale*m_data[i*m_width + j]));
|
||||
m_pG->fillRect(m_scaleX*j, m_scaleY*i, m_scaleX, m_scaleY);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user