コード例 #1
0
ファイル: bright_colors.C プロジェクト: alisw/AliRoot
void bright_colors(Float_t value=1)
{
  // Notes:
  // you can store the original colors by creating a clone of
  // (TObjArray*)gROOT->GetListOfColors() and restore the colors by
  // assigning the vector with original values to the list of colors
  // that gROOT handles.

  if (value > 5)
  {
    printf("Value %f too high - maximum is 5.\n", value);
    return;
  }
  value *= 0.1f;

  TObjArray *colors = (TObjArray*) gROOT->GetListOfColors();
  TColor    *color  = 0;
  Float_t    r, g, b;
  for (int i = 0; i < colors->GetSize(); ++i)
  {
    if ((color = dynamic_cast<TColor*>(colors->At(i))) != 0)
    {
      color->GetRGB(r, g, b);
      if (r < 0.01 && g < 0.01 && b < 0.01) continue; // skip black
      if (r > 0.95 && g > 0.95 && b > 0.95) continue; // skip white
      r = TMath::Min(r + value, 1.0f);
      g = TMath::Min(g + value, 1.0f);
      b = TMath::Min(b + value, 1.0f);
      color->SetRGB(r, g, b);
    }
  }

  if (gEve)
    gEve->FullRedraw3D();
}
コード例 #2
0
ファイル: r2iv_1.C プロジェクト: star-bnl/star-soft
   void ShapeHeader(void) {
      TVolumePosition *p =  (*GlobalIter)[GlobalIter->GetDepth()];

      Float_t ObjectX = p->GetX();
      Float_t ObjectY = p->GetY();
      Float_t ObjectZ = p->GetZ();
      Double_t* ObjectMatrix = p->GetMatrix()->GetMatrix() ;

      fprintf(
         TIVFile::File,
         "\tMatrixTransform { \n"
         "\t    matrix %f\t%f\t%f\t%f \n" 
         "\t           %f\t%f\t%f\t%f \n"
         "\t           %f\t%f\t%f\t%f \n"
         "\t           %f\t%f\t%f\t%f \n"
         "\t}\n\n",
         ObjectMatrix[0], ObjectMatrix[1], ObjectMatrix[2], 0,
         ObjectMatrix[3], ObjectMatrix[4], ObjectMatrix[5], 0,
         ObjectMatrix[6], ObjectMatrix[7], ObjectMatrix[8], 0,
         ObjectX, ObjectY, ObjectZ, 1
         ); 

      Color_t ColorOfObject = Volume->GetLineColor();
      TColor *colorObject = gROOT->GetColor(ColorOfObject);
      Float_t Objectred, Objectgreen, Objectblue;
      colorObject->GetRGB(Objectred, Objectgreen, Objectblue); 


      fprintf(
         TIVFile::File,
         "\tMaterial {\n"
         "\t    ambientColor %f %f %f \n"
         "\t}\n", 
         Objectred, Objectgreen, Objectblue 
         ); 
   }