Exemple #1
0
//------------------------------------------------------------------------------
// setMonitor() -- set the monitor parameters
//------------------------------------------------------------------------------
bool Cie::setMonitor(MonitorMetrics* const msg)
{
    if (msg == nullptr) return false;
    monitor = msg;
    cie2rgb(color,cie,monitor);
    return true;
}
Exemple #2
0
//------------------------------------------------------------------------------
// setY() -- set the X value
//------------------------------------------------------------------------------
bool Cie::setY(Number* const msg)
{
    if (msg == nullptr) return false;
    LCreal value = msg->getReal();
    bool ok = (value >= 0 && value <= 1);
    if (ok) { cie[Y] = value; cie2rgb(color,cie,monitor); }
    else std::cerr << "Cie::setY: invalid entry(" << value << "), valid range: 0 to 1" << std::endl;
    return ok;
}
Exemple #3
0
int
pcl::MTLReader::fillRGBfromXYZ (const std::vector<std::string>& split_line,
                                pcl::TexMaterial::RGB& rgb)
{
  Eigen::Vector3f xyz;
  if (split_line.size () == 5)
  {
    try
    {
      xyz[0] = boost::lexical_cast<float> (split_line[2]);
      xyz[1] = boost::lexical_cast<float> (split_line[3]);
      xyz[2] = boost::lexical_cast<float> (split_line[4]);
    }
    catch (boost::bad_lexical_cast &)
    {
      return (-1);
    }
  }
  else
    if (split_line.size () == 3)
    {
      try
      {
        xyz[0] = xyz[1] = xyz[2] = boost::lexical_cast<float> (split_line[2]);
      }
      catch (boost::bad_lexical_cast &)
      {
        return (-1);
      }
    }
    else
      return (-1);

  cie2rgb (xyz, rgb);
  return (0);
}