22#include <nlohmann/json.hpp>
24using namespace::ROOT::Experimental;
53REveBoxSet::REveBoxSet(
const char*
n,
const char* t) :
81 default:
throw(eH +
"unexpected atom type.");
118 throw(eH +
"expect free box-type.");
121 memcpy(
b->fVertices, verts,
sizeof(
b->fVertices));
135 throw(eH +
"expect axis-aligned box-type.");
151 throw(eH +
"expect axis-aligned fixed-dimension box-type.");
164 throw(eH +
"expect Mat4 box-type.");
167 memcpy(
b->fMat, arr,
sizeof(
b->fMat));
177 using namespace TMath;
182 float phi = ATan2(dir.
fY, dir.
fX);
183 float theta = ATan (dir.
fZ / Sqrt(dir.
fX*dir.
fX + dir.
fY*dir.
fY));
185 theta = Pi()/2 -theta;
192 for(
Int_t i=0; i<16; ++i)
193 cone->
fMat[i] = t[i];
203 static const REveException eH(
"REveBoxSet::AddEllipticCone ");
204 using namespace TMath;
208 float phi = ATan2(dir.
fY, dir.
fX);
209 float theta = ATan (dir.
fZ / Sqrt(dir.
fX*dir.
fX + dir.
fY*dir.
fY));
211 theta = Pi()/2 -theta;
219 for(
Int_t i=0; i<16; ++i)
220 cone->
fMat[i] = t[i];
233 throw(eH +
"expect hex box-type.");
242 for(
Int_t i=0; i<16; ++i)
258 for (
int i=0; i<
n; ++i, bbps+=3)
279 for (
Int_t i = 0; i < 8; ++i)
317 throw eH +
"unsupported box-type.";
341 std::string instanceFlag;
345 instanceFlag =
"FixedDimension";
349 instanceFlag =
"ScalePerDigit";
353 instanceFlag =
"Mat4Trans";
365 j[
"instanceFlag"] = instanceFlag;
399 int value =
c[0] +
c[1] * 256 +
c[2] * 256 * 256;
420 return (
c[0] << 16) + (
c[1] << 8) +
c[2];
425 return (
c[0] << 16) + (
c[1] << 8) +
c[2];
432 return (
c[0] << 16) + (
c[1] << 8) +
c[2];
439 auto pc = (
float *) &
c;
453 for (
int c = 0;
c < 8;
c++) {
454 for (
int j = 0; j < 3; j++)
483 for (
int i = 0; i < 12; i++) {
489 default: assert(
false &&
"REveBoxSet::BuildRenderData only kBT_FreeBox type supported");
502 for(
Int_t i=0; i<nboxes; ++i)
529bool REveBoxSet::SetDigitShape(const std::vector<float>& vrtBuff, const std::vector<int>& idxBuff)
#define R__LOG_ERROR(...)
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
Option_t Option_t TPoint TPoint angle
void AddInstanceMat4(const Float_t *mat4)
Create shape with arbitrary transformtaion.
@ kBT_InstancedScaledRotated
void AddEllipticCone(const REveVector &pos, const REveVector &dir, Float_t r, Float_t r2, Float_t angle=0)
Create a cone with apex at pos, axis dir and radius r.
void ComputeBBox() override
Fill bounding-box information of the base-class TAttBBox (virtual method).
Int_t WriteCoreJson(nlohmann::json &j, Int_t rnr_offset) override
Fill core part of JSON representation.
void BuildRenderData() override
Creates 3D point array for rendering.
void Test(Int_t nboxes)
Fill the structure with a random set of boxes.
void AddCone(const REveVector &pos, const REveVector &dir, Float_t r)
Create a cone with apex at pos, axis dir and radius r.
void Reset()
Reset the data containers to zero size.
void AddInstanceScaled(Float_t a, Float_t b, Float_t c, Float_t w, Float_t h, Float_t d)
Create a new axis-aligned box from at a given position and with specified dimensions.
void AddHex(const REveVector &pos, Float_t r, Float_t angle, Float_t depth)
Create a hexagonal prism with center of one hexagon at pos, radius of hexagon vertices r,...
unsigned int GetColorFromDigit(REveDigitSet::DigitBase_t &digit)
Get int value for color.
float GetColorFromDigitAsFloat(REveDigitSet::DigitBase_t &digit)
void WriteShapeData(REveDigitSet::DigitBase_t &digit)
Write shape data for different cases.
void AddFreeBox(const Float_t *verts)
Create a new box from a set of 8 vertices.
static Int_t SizeofAtom(EBoxType_e bt)
Return size of data-structure describing a box of type bt.
bool Instanced()
Use instancing in RenderCore.
void AddInstance(Float_t a, Float_t b, Float_t c)
Create a new axis-aligned box from at a given position.
void Reset(Int_t atom_size, Int_t chunk_size)
Empty the container and reset it with given atom and chunk sizes.
Int_t WriteCoreJson(nlohmann::json &j, Int_t rnr_offset) override
Fill core part of JSON representation.
DigitBase_t * NewDigit()
Function providing highlight tooltips when always-sec-select is active.
bool IsDigitVisible(const DigitBase_t *) const
Utility function for maping digit idx with visible shape idx.
REveRGBAPalette * fPalette
void ReleaseIds()
Protected method.
void DigitValue(Int_t value)
Set signal value for the last digit added.
std::unique_ptr< REveRenderData > fRenderData
Externally assigned and controlled user data.
virtual Color_t GetMainColor() const
REveException Exception-type thrown by Eve classes.
Int_t GetFrameSize() const
Float_t * GetFramePoints() const
const UChar_t * ColorFromValue(Int_t val) const
static void CalcTextureSize(int nel, int align, int &sx, int &sy)
Calculate texture dimensions to hold nel elements with given alignment on x axis.
static void CheckAndFixBoxOrientationFv(Float_t box[8][3])
Make sure box orientation is consistent with standard arrangement.
void RotatePF(Int_t i1, Int_t i2, Double_t amount)
Rotate in parent frame. Does optimised version of MultLeft.
void RotateLF(Int_t i1, Int_t i2, Double_t amount)
Rotate in local frame. Does optimised version of MultRight.
void SetScale(Double_t sx, Double_t sy, Double_t sz)
Set scaling.
void SetPos(Double_t x, Double_t y, Double_t z)
Set position (base-vec 4).
static void ColorFromIdx(Color_t ci, UChar_t col[4], Bool_t alpha=kTRUE)
Fill col with RGBA values corresponding to index ci.
void BBoxCheckPoint(Float_t x, Float_t y, Float_t z)
void BBoxZero(Float_t epsilon=0, Float_t x=0, Float_t y=0, Float_t z=0)
Create cube of volume (2*epsilon)^3 at (x,y,z).
void BBoxInit(Float_t infinity=1e6)
Dynamic Float_t[6] X(min,max), Y(min,max), Z(min,max)
This is the base class for the ROOT Random number generators.
virtual Double_t Uniform(Double_t x1=1)
Returns a uniform deviate on the interval (0, x1).
virtual UInt_t Integer(UInt_t imax)
Returns a random integer uniformly distributed on the interval [ 0, imax-1 ].
void box(Int_t pat, Double_t x1, Double_t y1, Double_t x2, Double_t y2)
R__EXTERN REveManager * gEve
RLogChannel & REveLog()
Log channel for Eve diagnostics.
Short_t Max(Short_t a, Short_t b)
Returns the largest of a and b.
constexpr Double_t DegToRad()
Conversion from degree to radian: .
Bool_t next()
Go to next atom.