Skip to content

Commit 9c4c0bb

Browse files
committed
Build with TCrown ratio support
1 parent f89f24b commit 9c4c0bb

File tree

1 file changed

+24
-22
lines changed

1 file changed

+24
-22
lines changed

build/jsroot.js

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -89209,9 +89209,9 @@ function createTubeBuffer(shape, faces_limit) {
8920989209
if (faces_limit < 0) return numfaces;
8921089210

8921189211
const phi0 = thetaStart*Math.PI/180,
89212-
dphi = thetaLength/radiusSegments*Math.PI/180,
89213-
_sin = new Float32Array(radiusSegments+1),
89214-
_cos = new Float32Array(radiusSegments+1);
89212+
dphi = thetaLength/radiusSegments*Math.PI/180,
89213+
_sin = new Float32Array(radiusSegments+1),
89214+
_cos = new Float32Array(radiusSegments+1);
8921589215

8921689216
for (let seg = 0; seg <= radiusSegments; ++seg) {
8921789217
_cos[seg] = Math.cos(phi0+seg*dphi);
@@ -150703,21 +150703,23 @@ function drawEllipse() {
150703150703
x = funcs.x(ellipse.fX1),
150704150704
y = funcs.y(ellipse.fY1),
150705150705
rx = is_crown && (ellipse.fR1 <= 0) ? (funcs.x(ellipse.fX1 + ellipse.fR2) - x) : (funcs.x(ellipse.fX1 + ellipse.fR1) - x),
150706-
ry = y - funcs.y(ellipse.fY1 + ellipse.fR2);
150706+
ry = y - funcs.y(ellipse.fY1 + ellipse.fR2),
150707+
dr = Math.PI/180;
150707150708

150708150709
let path = '';
150709150710

150710150711
if (is_crown && (ellipse.fR1 > 0)) {
150711-
const rx1 = rx, ry2 = ry,
150712-
ry1 = y - funcs.y(ellipse.fY1 + ellipse.fR1),
150712+
const ratio = ellipse.fYXRatio ?? 1,
150713+
rx1 = rx, ry2 = ratio * ry,
150714+
ry1 = ratio * (y - funcs.y(ellipse.fY1 + ellipse.fR1)),
150713150715
rx2 = funcs.x(ellipse.fX1 + ellipse.fR2) - x;
150714150716

150715150717
if (closed_ellipse) {
150716150718
path = `M${-rx1},0A${rx1},${ry1},0,1,0,${rx1},0A${rx1},${ry1},0,1,0,${-rx1},0` +
150717150719
`M${-rx2},0A${rx2},${ry2},0,1,0,${rx2},0A${rx2},${ry2},0,1,0,${-rx2},0`;
150718150720
} else {
150719150721
const large_arc = (ellipse.fPhimax-ellipse.fPhimin>=180) ? 1 : 0,
150720-
a1 = ellipse.fPhimin*Math.PI/180, a2 = ellipse.fPhimax*Math.PI/180,
150722+
a1 = ellipse.fPhimin*dr, a2 = ellipse.fPhimax*dr,
150721150723
dx1 = Math.round(rx1*Math.cos(a1)), dy1 = Math.round(ry1*Math.sin(a1)),
150722150724
dx2 = Math.round(rx1*Math.cos(a2)), dy2 = Math.round(ry1*Math.sin(a2)),
150723150725
dx3 = Math.round(rx2*Math.cos(a1)), dy3 = Math.round(ry2*Math.sin(a1)),
@@ -150730,22 +150732,22 @@ function drawEllipse() {
150730150732
if (closed_ellipse)
150731150733
path = `M${-rx},0A${rx},${ry},0,1,0,${rx},0A${rx},${ry},0,1,0,${-rx},0Z`;
150732150734
else {
150733-
const x1 = Math.round(rx * Math.cos(ellipse.fPhimin*Math.PI/180)),
150734-
y1 = Math.round(ry * Math.sin(ellipse.fPhimin*Math.PI/180)),
150735-
x2 = Math.round(rx * Math.cos(ellipse.fPhimax*Math.PI/180)),
150736-
y2 = Math.round(ry * Math.sin(ellipse.fPhimax*Math.PI/180));
150735+
const x1 = Math.round(rx * Math.cos(ellipse.fPhimin*dr)),
150736+
y1 = Math.round(ry * Math.sin(ellipse.fPhimin*dr)),
150737+
x2 = Math.round(rx * Math.cos(ellipse.fPhimax*dr)),
150738+
y2 = Math.round(ry * Math.sin(ellipse.fPhimax*dr));
150737150739
path = `M0,0L${x1},${y1}A${rx},${ry},0,1,1,${x2},${y2}Z`;
150738150740
}
150739150741
} else {
150740-
const ct = Math.cos(ellipse.fTheta*Math.PI/180),
150741-
st = Math.sin(ellipse.fTheta*Math.PI/180),
150742-
phi1 = ellipse.fPhimin*Math.PI/180,
150743-
phi2 = ellipse.fPhimax*Math.PI/180,
150744-
np = 200,
150745-
dphi = (phi2-phi1) / (np - (closed_ellipse ? 0 : 1));
150746-
let lastx = 0, lasty = 0;
150747-
if (!closed_ellipse) path = 'M0,0';
150748-
for (let n = 0; n < np; ++n) {
150742+
const ct = Math.cos(ellipse.fTheta*dr),
150743+
st = Math.sin(ellipse.fTheta*dr),
150744+
phi1 = ellipse.fPhimin*dr,
150745+
phi2 = ellipse.fPhimax*dr,
150746+
np = 200,
150747+
dphi = (phi2-phi1) / (np - (closed_ellipse ? 0 : 1));
150748+
let lastx = 0, lasty = 0;
150749+
if (!closed_ellipse) path = 'M0,0';
150750+
for (let n = 0; n < np; ++n) {
150749150751
const angle = phi1 + n*dphi,
150750150752
dx = ellipse.fR1 * Math.cos(angle),
150751150753
dy = ellipse.fR2 * Math.sin(angle),
@@ -150760,8 +150762,8 @@ function drawEllipse() {
150760150762
else
150761150763
path += `l${px-lastx},${py-lasty}`;
150762150764
lastx = px; lasty = py;
150763-
}
150764-
path += 'Z';
150765+
}
150766+
path += 'Z';
150765150767
}
150766150768

150767150769
this.x = x;

0 commit comments

Comments
 (0)