24#include <nlohmann/json.hpp>
26using namespace::ROOT::Experimental;
65REveBoxSet::REveBoxSet(
const char*
n,
const char* t) :
93 default:
throw(eH +
"unexpected atom type.");
148 throw(eH +
"expect box-type kBT_Vertices.");
151 memcpy(
b->fVertices, verts,
sizeof(
b->fVertices));
162 static const REveException eH(
"REveBoxSet::AddInstanceScaled ");
165 throw(eH +
"expect box-type kBT_InstancedScaled.");
196 throw(eH +
"expect box-type kBT_Instanced.");
220 static const REveException eH(
"REveBoxSet::AddInstanceMat4 ");
222 throw(eH +
"expect box-type kBT_InstancedScaledRotated.");
225 memcpy(
b->fMat, arr,
sizeof(
b->fMat));
235 using namespace TMath;
237 throw(eH +
"expect box-type kBT_InstancedScaledRotated.");
242 float phi = ATan2(dir.
fY, dir.
fX);
243 float theta = ATan (dir.
fZ / Sqrt(dir.
fX*dir.
fX + dir.
fY*dir.
fY));
245 theta = Pi()/2 -theta;
252 for(
Int_t i=0; i<16; ++i)
253 cone->
fMat[i] = t[i];
263 static const REveException eH(
"REveBoxSet::AddEllipticCone ");
264 using namespace TMath;
266 throw(eH +
"expect box-type kBT_InstancedScaledRotated.");
270 float phi = ATan2(dir.
fY, dir.
fX);
271 float theta = ATan (dir.
fZ / Sqrt(dir.
fX*dir.
fX + dir.
fY*dir.
fY));
273 theta = Pi()/2 -theta;
281 for(
Int_t i=0; i<16; ++i)
282 cone->
fMat[i] = t[i];
295 throw(eH +
"expect box-type kBT_InstancedScaledRotated.");
304 for(
Int_t i=0; i<16; ++i)
320 for (
int i=0; i<
n; ++i, bbps+=3)
341 for (
Int_t i = 0; i < 8; ++i)
365 for (
Int_t k = 0; k < 3; ++k)
366 h[k] = std::abs(
a[k]) + std::abs(
a[4 + k]) + std::abs(
a[8 + k]);
373 throw eH +
"unsupported box-type.";
395 std::string instanceFlag;
399 instanceFlag =
"FixedDimension";
403 instanceFlag =
"ScalePerDigit";
407 instanceFlag =
"Mat4Trans";
419 j[
"instanceFlag"] = instanceFlag;
460 int value =
c[0] +
c[1] * 256 +
c[2] * 256 * 256;
483 return (
c[0] << 16) + (
c[1] << 8) +
c[2];
488 return (
c[0] << 16) + (
c[1] << 8) +
c[2];
495 return (
c[0] << 16) + (
c[1] << 8) +
c[2];
502 auto pc = (
float *) &
c;
516 for (
int c = 0;
c < 8;
c++) {
517 for (
int j = 0; j < 3; j++)
546 for (
int i = 0; i < 12; i++) {
552 default: assert(
false &&
"REveBoxSet::BuildRenderData only kBT_Vertices type supported");
565 for(
Int_t i=0; i<nboxes; ++i)
592bool 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
unsigned char UChar_t
Unsigned Character 1 byte (unsigned char)
float Float_t
Float 4 bytes (float)
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 the bounding box (virtual from REveElement).
void AddInstanceCorner(Float_t x, Float_t y, Float_t z)
Create a new axis-aligned box with lower corner (x, y, z) and the default size, see SetDefWidth() and...
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 InstanceHalfSize(const DigitBase_t &digit, Float_t half[3]) const
Half size of an axis-aligned instance, kBT_Instanced or kBT_InstancedScaled, as the client draws it.
EInstanceShape_e fInstanceShape
void AddVertices(const Float_t *verts)
Create a new box from a set of 8 vertices.
void AddInstanceScaled(Float_t cx, Float_t cy, Float_t cz, Float_t hw, Float_t hh, Float_t hd)
Create a new axis-aligned box with centre (cx, cy, cz) and half size (hw, hh, hd).
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.
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 cx, Float_t cy, Float_t cz)
Create a new axis-aligned box with centre (cx, cy, cz) and the default size, see SetDefWidth() and Se...
void AddInstanceScaledCorner(Float_t x, Float_t y, Float_t z, Float_t w, Float_t h, Float_t d)
Create a new axis-aligned box with lower corner (x, y, z) and size (w, h, d).
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()
Protected method called whenever a new digit is added.
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.
void BBoxCheckPoint(const REveVector &v)
std::unique_ptr< REveRenderData > fRenderData
! Vertex / normal / triangle index information for rendering.
void BBoxZero(Float_t epsilon=0, Float_t x=0, Float_t y=0, Float_t z=0)
Set the bounding box to a cube of half-side epsilon at (x, y, z); with the defaults,...
void BBoxInit()
Start filling the bounding box with BBoxCheckPoint(): min at +infinity, max at -infinity,...
void BBoxCheckBox(const REveVector &c, const REveVector &h)
Grow the box to hold the axis-aligned box with centre c and half sizes h.
virtual Color_t GetMainColor() const
virtual void BuildRenderData()
Build fRenderData, what the client draws.
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 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.
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)
ROOT::RLogChannel & REveLog()
Log channel for Eve diagnostics.
R__EXTERN REveManager * gEve
REveVectorT< Float_t > REveVector
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.