20 using namespace ROOT::Experimental;
 
   21 namespace REX = ROOT::Experimental;
 
   28 Bool_t REveLine::fgDefaultSmooth = kFALSE;
 
   34 REveLine::REveLine(
const std::string &name, 
const std::string &title, Int_t n_points) :
 
   35    REvePointSet(name, title, n_points),
 
   38    fSmooth    (fgDefaultSmooth)
 
   40    fMainColorPtr = &fLineColor;
 
   41    fMarkerColor  = kGreen;
 
   47 REveLine::REveLine(
const REveLine &l) :
 
   50    fRnrLine    (l.fRnrLine),
 
   51    fRnrPoints  (l.fRnrPoints),
 
   59 void REveLine::SetMarkerColor(Color_t col)
 
   61    for (
auto &pi: fProjectedList)
 
   63       REveLine* l = 
dynamic_cast<REveLine*
>(pi);
 
   64       if (l && fMarkerColor == l->GetMarkerColor())
 
   66          l->SetMarkerColor(col);
 
   70    TAttMarker::SetMarkerColor(col);
 
   77 void REveLine::SetLineStyle(Style_t lstyle)
 
   79    for (
auto &pi: fProjectedList)
 
   81       REveLine* pt = 
dynamic_cast<REveLine*
>(pi);
 
   84          pt->SetLineStyle(lstyle);
 
   88    TAttLine::SetLineStyle(lstyle);
 
   95 void REveLine::SetLineWidth(Width_t lwidth)
 
   97    for (
auto &pi: fProjectedList)
 
   99       REveLine* pt = 
dynamic_cast<REveLine*
>(pi);
 
  102          pt->SetLineWidth(lwidth);
 
  107    TAttLine::SetLineWidth(lwidth);
 
  113 void REveLine::SetRnrLine(Bool_t r)
 
  116    for (
auto &pi: fProjectedList)
 
  118       REveLine* l = 
dynamic_cast<REveLine*
>(pi);
 
  131 void REveLine::SetRnrPoints(Bool_t r)
 
  134    for (
auto &pi: fProjectedList)
 
  136       REveLine *l = 
dynamic_cast<REveLine*
>(pi);
 
  149 void REveLine::SetSmooth(Bool_t r)
 
  152    for (
auto &pi: fProjectedList)
 
  154       REveLine* l = 
dynamic_cast<REveLine*
>(pi);
 
  168 void REveLine::ReduceSegmentLengths(Float_t max)
 
  172    const Float_t max2 = max*max;
 
  174    Float_t    *p = & fPoints[0].fX;
 
  178    std::vector<REveVector> q;
 
  182    for (Int_t i = 1; i < s; ++i)
 
  184       a = b; b.Set(&p[3*i]); d = b - a;
 
  185       Float_t m2 = d.Mag2();
 
  188          Float_t f = TMath::Sqrt(m2) / max;
 
  189          Int_t   n = TMath::FloorNint(f);
 
  191          for (Int_t j = 0; j < n; ++j)
 
  203       SetNextPoint(i.fX, i.fY, i.fZ);
 
  209 Float_t REveLine::CalculateLineLength()
 const 
  213    for (Int_t i = 1; i < fSize; ++i)
 
  215       sum += fPoints[i - 1].Distance(fPoints[i]);
 
  225 REveVector REveLine::GetLineStart()
 const 
  228    if (fSize > 0) v = RefPoint(0);
 
  236 REveVector REveLine::GetLineEnd()
 const 
  239    if (fSize > 0) v = RefPoint(fSize - 1);
 
  246 void REveLine::CopyVizParams(
const REveElement* el)
 
  248    const REveLine* m = 
dynamic_cast<const REveLine*
>(el);
 
  251       TAttLine::operator=(*m);
 
  252       fRnrLine   = m->fRnrLine;
 
  253       fRnrPoints = m->fRnrPoints;
 
  254       fSmooth    = m->fSmooth;
 
  257    REvePointSet::CopyVizParams(el);
 
  263 void REveLine::WriteVizParams(std::ostream& out, 
const TString& var)
 
  265    REvePointSet::WriteVizParams(out, var);
 
  267    TString t = 
"   " + var + 
"->";
 
  268    TAttLine::SaveLineAttributes(out, var);
 
  269    out << t << 
"SetRnrLine("   << ToString(fRnrLine)   << 
");\n";
 
  270    out << t << 
"SetRnrPoints(" << ToString(fRnrPoints) << 
");\n";
 
  271    out << t << 
"SetSmooth("    << ToString(fSmooth)    << 
");\n";
 
  277 TClass* REveLine::ProjectedClass(
const REveProjection*)
 const 
  279    return TClass::GetClass<REveLineProjected>();
 
  284 Int_t REveLine::WriteCoreJson(nlohmann::json &j, Int_t rnr_offset)
 
  286    Int_t ret = REvePointSet::WriteCoreJson(j, rnr_offset);
 
  288    j[
"fLineWidth"] = GetLineWidth();
 
  289    j[
"fLineStyle"] = GetLineStyle();
 
  290    j[
"fLineColor"] = GetLineColor();
 
  298 void REveLine::BuildRenderData()
 
  302       fRenderData = std::make_unique<REveRenderData>(
"makeTrack", 3*fSize);
 
  303       fRenderData->PushV(&fPoints[0].fX, 3*fSize);
 
  311 Bool_t REveLine::GetDefaultSmooth()
 
  313    return fgDefaultSmooth;
 
  320 void REveLine::SetDefaultSmooth(Bool_t r)
 
  334 REveLineProjected::REveLineProjected() :
 
  344 void REveLineProjected::SetProjection(REveProjectionManager* mng,
 
  345                                       REveProjectable* model)
 
  347    REveProjected::SetProjection(mng, model);
 
  348    CopyVizParams(dynamic_cast<REveElement*>(model));
 
  354 void REveLineProjected::SetDepthLocal(Float_t d)
 
  356    SetDepthCommon(d, 
this, fBBox);
 
  359    Float_t *p = & fPoints[0].fZ;
 
  360    for (Int_t i = 0; i < n; ++i, p+=3)
 
  368 void REveLineProjected::UpdateProjection()
 
  370    REveProjection& proj = * fManager->GetProjection();
 
  371    REveLine      & als  = * 
dynamic_cast<REveLine*
>(fProjectable);
 
  372    REveTrans      *tr   =   als.PtrMainTrans(kFALSE);
 
  374    Int_t n = als.GetSize();
 
  377    const Float_t *o = & als.RefPoint(0).fX;
 
  378          Float_t *p = & fPoints[0].fX;
 
  379    for (Int_t i = 0; i < n; ++i, o+=3, p+=3)
 
  381       proj.ProjectPointfv(tr, o, p, fDepth);