Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-18 09:32:06

0001 // @(#)root/eve7:$Id$
0002 // Author: Matevz Tadel, 2010, 2018
0003 
0004 /*************************************************************************
0005  * Copyright (C) 1995-2019, Rene Brun and Fons Rademakers.               *
0006  * All rights reserved.                                                  *
0007  *                                                                       *
0008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0010  *************************************************************************/
0011 
0012 #ifndef ROOT7_REveShape
0013 #define ROOT7_REveShape
0014 
0015 #include <ROOT/REveElement.hxx>
0016 #include <ROOT/REveVector.hxx>
0017 
0018 #include "TAttBBox.h"
0019 #include "TColor.h"
0020 
0021 namespace ROOT {
0022 namespace Experimental {
0023 
0024 // =========================================================================
0025 // REveShape
0026 // Abstract base-class for 2D/3D shapes.
0027 // =========================================================================
0028 
0029 class REveShape : public REveElement,
0030                   public TAttBBox
0031 {
0032 private:
0033    REveShape(const REveShape &) = delete;
0034    REveShape &operator=(const REveShape &) = delete;
0035 
0036 public:
0037    typedef std::vector<REveVector2> vVector2_t;
0038 
0039 protected:
0040    Color_t fFillColor = 7;   // fill color of polygons
0041    Color_t fLineColor = 12;  // outline color of polygons
0042    UChar_t fFillAlpha = 255; // alpha of the fill
0043    UChar_t fLineAlpha = 255; // alpha of outline
0044    Float_t fLineWidth = 1;   // outline width of polygons
0045 
0046    Bool_t fDrawFrame      = true;  // draw frame
0047    Bool_t fHighlightFrame = false; // highlight frame / all shape
0048    Bool_t fMiniFrame      = true;  // draw minimal frame
0049 
0050 public:
0051    REveShape(const std::string &n = "REveShape", const std::string &t = "");
0052    ~REveShape() override;
0053 
0054    Int_t WriteCoreJson(nlohmann::json &j, Int_t rnr_offset) override;
0055 
0056    // Rendering parameters.
0057    void SetMainColor(Color_t color) override;
0058 
0059    Color_t GetFillColor() const { return fFillColor; }
0060    Color_t GetLineColor() const { return fLineColor; }
0061    UChar_t GetFillAlpha() const { return fFillAlpha; }
0062    UChar_t GetLineAlpha() const { return fLineAlpha; }
0063    Float_t GetLineWidth() const { return fLineWidth; }
0064    Bool_t GetDrawFrame() const { return fDrawFrame; }
0065    Bool_t GetHighlightFrame() const { return fHighlightFrame; }
0066    Bool_t GetMiniFrame() const { return fMiniFrame; }
0067 
0068    void SetFillColor(Color_t c) { fFillColor = c; StampObjProps(); }
0069    void SetLineColor(Color_t c) { fLineColor = c; StampObjProps(); }
0070    void SetFillAlpha(UChar_t c) { fFillAlpha = c; StampObjProps(); }
0071    void SetLineAlpha(UChar_t c) { fLineAlpha = c; StampObjProps(); }
0072    void SetLineWidth(Float_t lw) { fLineWidth = lw; StampObjProps(); }
0073    void SetDrawFrame(Bool_t f) { fDrawFrame = f; StampObjProps(); }
0074    void SetHighlightFrame(Bool_t f) { fHighlightFrame = f; StampObjProps(); }
0075    void SetMiniFrame(Bool_t r) { fMiniFrame = r; StampObjProps(); }
0076 
0077    // ----------------------------------------------------------------
0078 
0079    void CopyVizParams(const REveElement *el) override;
0080    void WriteVizParams(std::ostream &out, const TString &var) override;
0081 
0082    // ----------------------------------------------------------------
0083 
0084    // Abstract function from TAttBBox:
0085    // virtual void ComputeBBox();
0086 
0087    // ----------------------------------------------------------------
0088 
0089    static Int_t FindConvexHull(const vVector2_t &pin, vVector2_t &pout, REveElement *caller = nullptr);
0090 
0091    static Bool_t IsBoxOrientationConsistentEv(const REveVector box[8]);
0092    static Bool_t IsBoxOrientationConsistentFv(const Float_t box[8][3]);
0093 
0094    static void CheckAndFixBoxOrientationEv(REveVector box[8]);
0095    static void CheckAndFixBoxOrientationFv(Float_t box[8][3]);
0096 };
0097 
0098 } // namespace Experimental
0099 } // namespace ROOT
0100 
0101 #endif