Skip to content

Commit 59e4092

Browse files
committed
Build with TH3 box1 and negative bins
1 parent 9daa872 commit 59e4092

File tree

1 file changed

+38
-34
lines changed

1 file changed

+38
-34
lines changed

build/jsroot.js

Lines changed: 38 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -58351,6 +58351,7 @@ const Box3D = {
5835158351
7, 6, 2, 6, 3, 2, 5, 7, 0, 7, 2, 0, 1, 3, 4, 3, 6, 4],
5835258352
Normals: [1, 0, 0, -1, 0, 0, 0, 1, 0, 0, -1, 0, 0, 0, 1, 0, 0, -1],
5835358353
Segments: [0, 2, 2, 7, 7, 5, 5, 0, 1, 3, 3, 6, 6, 4, 4, 1, 1, 0, 3, 2, 6, 7, 4, 5], // segments addresses Vertices
58354+
Crosses: [0, 7, 2, 5, 0, 3, 1, 2, 7, 3, 2, 6, 5, 6, 4, 7, 5, 1, 0, 4, 3, 4, 1, 6], // addresses Vertices
5835458355
MeshSegments: undefined
5835558356
};
5835658357

@@ -75096,6 +75097,7 @@ class THistDrawOptions {
7509675097
this.Box = this.BoxStyle > 0;
7509775098

7509875099
if (d.check('CJUST')) this.Cjust = true;
75100+
if (d.check('COL7')) this.Color = 7; // special color mode with use of bar offset
7509975101
if (d.check('COL')) this.Color = true;
7510075102
if (d.check('CHAR')) this.Char = 1;
7510175103
if (d.check('ALLFUNC')) this.AllFunc = true;
@@ -77154,23 +77156,22 @@ class THistPainter extends ObjectPainter {
7715477156
res.grx = res.i1 < 0 ? {} : new Float32Array(res.i2 + 1);
7715577157
res.gry = res.j1 < 0 ? {} : new Float32Array(res.j2 + 1);
7715677158

77157-
if ((typeof histo.fBarOffset === 'number') && (typeof histo.fBarWidth === 'number') &&
77158-
(histo.fBarOffset || histo.fBarWidth !== 1000)) {
77159-
if (histo.fBarOffset <= 1000)
77160-
res.xbar1 = res.ybar1 = 0.001*histo.fBarOffset;
77161-
else if (histo.fBarOffset <= 3000)
77162-
res.xbar1 = 0.001*(histo.fBarOffset-2000);
77163-
else if (histo.fBarOffset <= 5000)
77164-
res.ybar1 = 0.001*(histo.fBarOffset-4000);
77159+
if ((typeof histo.fBarOffset === 'number') && (typeof histo.fBarWidth === 'number') && (histo.fBarOffset || (histo.fBarWidth !== 1000))) {
77160+
if (histo.fBarOffset <= 1000)
77161+
res.xbar1 = res.ybar1 = 0.001 * histo.fBarOffset;
77162+
else if (histo.fBarOffset <= 3000)
77163+
res.xbar1 = 0.001 * (histo.fBarOffset - 2000);
77164+
else if (histo.fBarOffset <= 5000)
77165+
res.ybar1 = 0.001 * (histo.fBarOffset - 4000);
7716577166

77166-
if (histo.fBarWidth <= 1000) {
77167-
res.xbar2 = Math.min(1, res.xbar1 + 0.001*histo.fBarWidth);
77168-
res.ybar2 = Math.min(1, res.ybar1 + 0.001*histo.fBarWidth);
77169-
} else if (histo.fBarWidth <= 3000)
77170-
res.xbar2 = Math.min(1, res.xbar1 + 0.001*(histo.fBarWidth-2000));
77171-
else if (histo.fBarWidth <= 5000)
77172-
res.ybar2 = Math.min(1, res.ybar1 + 0.001*(histo.fBarWidth-4000));
77173-
}
77167+
if (histo.fBarWidth <= 1000) {
77168+
res.xbar2 = Math.min(1, res.xbar1 + 0.001 * histo.fBarWidth);
77169+
res.ybar2 = Math.min(1, res.ybar1 + 0.001 * histo.fBarWidth);
77170+
} else if (histo.fBarWidth <= 3000)
77171+
res.xbar2 = Math.min(1, res.xbar1 + 0.001 * (histo.fBarWidth - 2000));
77172+
else if (histo.fBarWidth <= 5000)
77173+
res.ybar2 = Math.min(1, res.ybar1 + 0.001 * (histo.fBarWidth - 4000));
77174+
}
7717477175

7717577176
if (args.original) {
7717677177
res.original = true;
@@ -78553,8 +78554,8 @@ let TH2Painter$2 = class TH2Painter extends THistPainter {
7855378554
palette = this.getHistPalette(),
7855478555
entries = [],
7855578556
show_empty = this.options.ShowEmpty,
78556-
can_merge_x = (handle.xbar2 === 1) && (handle.xbar1 === 0),
78557-
can_merge_y = (handle.ybar2 === 1) && (handle.ybar1 === 0),
78557+
can_merge_x = (this.options.Color !== 7) || ((handle.xbar1 === 0) && (handle.xbar2 === 1)),
78558+
can_merge_y = (this.options.Color !== 7) || ((handle.ybar1 === 0) && (handle.ybar2 === 1)),
7855878559
colindx0 = cntr.getPaletteIndex(palette, 0);
7855978560

7856078561
let dx, dy, x1, y2, binz, is_zero, colindx, last_entry = null,
@@ -85508,7 +85509,7 @@ class TH3Painter extends THistPainter {
8550885509

8550985510
const cntr = use_colors ? this.getContour() : null,
8551085511
palette = use_colors ? this.getHistPalette() : null,
85511-
bins_matrixes = [], bins_colors = [], bins_ids = [], bin_opacities = [],
85512+
bins_matrixes = [], bins_colors = [], bins_ids = [], negative_matrixes = [], bin_opacities = [],
8551285513
transfer = (this.transferFunc && proivdeEvalPar(this.transferFunc, true)) ? this.transferFunc : null;
8551385514

8551485515
for (let i = i1; i < i2; ++i) {
@@ -85544,6 +85545,8 @@ class TH3Painter extends THistPainter {
8554485545
bin_matrix.scale(new THREE.Vector3((grx2 - grx1) * wei, (gry2 - gry1) * wei, (grz2 - grz1) * wei));
8554585546
bin_matrix.setPosition((grx2 + grx1) / 2, (gry2 + gry1) / 2, (grz2 + grz1) / 2);
8554685547
bins_matrixes.push(bin_matrix);
85548+
if (bin_content < 0)
85549+
negative_matrixes.push(bin_matrix);
8554785550
}
8554885551
}
8554985552
}
@@ -85626,23 +85629,24 @@ class TH3Painter extends THistPainter {
8562685629
}
8562785630

8562885631
if (use_helper) {
85629-
const helper_segments = Box3D.Segments,
85630-
helper_positions = new Float32Array(bins_matrixes.length * Box3D.Segments.length * 3);
85631-
let vvv = 0;
85632-
for (let i = 0; i < bins_matrixes.length; ++i) {
85633-
const m = bins_matrixes[i].elements;
85634-
for (let n = 0; n < helper_segments.length; ++n, vvv += 3) {
85635-
const vert = Box3D.Vertices[helper_segments[n]];
85636-
helper_positions[vvv] = m[12] + (vert.x - 0.5) * m[0];
85637-
helper_positions[vvv+1] = m[13] + (vert.y - 0.5) * m[5];
85638-
helper_positions[vvv+2] = m[14] + (vert.z - 0.5) * m[10];
85632+
const helper_material = new THREE.LineBasicMaterial({ color: this.getColor(histo.fLineColor) });
85633+
function addLines(segments, matrixes) {
85634+
if (!matrixes)
85635+
return;
85636+
const positions = new Float32Array(matrixes.length * segments.length * 3);
85637+
for (let i = 0, vvv = 0; i < matrixes.length; ++i) {
85638+
const m = matrixes[i].elements;
85639+
for (let n = 0; n < segments.length; ++n, vvv += 3) {
85640+
const vert = Box3D.Vertices[segments[n]];
85641+
positions[vvv] = m[12] + (vert.x - 0.5) * m[0];
85642+
positions[vvv+1] = m[13] + (vert.y - 0.5) * m[5];
85643+
positions[vvv+2] = m[14] + (vert.z - 0.5) * m[10];
85644+
}
8563985645
}
85646+
main.add3DMesh(createLineSegments(positions, helper_material));
8564085647
}
85641-
85642-
const helper_material = new THREE.LineBasicMaterial({ color: this.getColor(histo.fLineColor) }),
85643-
lines = createLineSegments(helper_positions, helper_material);
85644-
85645-
main.add3DMesh(lines);
85648+
addLines(Box3D.Segments, bins_matrixes);
85649+
addLines(Box3D.Crosses, negative_matrixes);
8564685650
}
8564785651

8564885652
return true;

0 commit comments

Comments
 (0)