Skip to content

Commit 1f278fa

Browse files
committed
suspend points; scale sizes
1 parent bdf65a5 commit 1f278fa

File tree

1 file changed

+22
-14
lines changed

1 file changed

+22
-14
lines changed

src/traces/streamtubes/convert.js

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ proto.update = function(data) {
212212
connectGaps: data.connectgaps
213213
};
214214

215-
if(this.mode.indexOf('lines') !== -1) {
215+
if(false && this.mode.indexOf('lines') !== -1) {
216216
if(this.linePlot) this.linePlot.update(lineOptions);
217217
else {
218218
this.linePlot = createLinePlot(lineOptions);
@@ -241,7 +241,7 @@ proto.update = function(data) {
241241
projectOpacity: options.projectOpacity
242242
};
243243

244-
if(this.mode.indexOf('markers') !== -1) {
244+
if(false && this.mode.indexOf('markers') !== -1) {
245245
if(this.scatterPlot) this.scatterPlot.update(scatterOptions);
246246
else {
247247
this.scatterPlot = createScatterPlot(scatterOptions);
@@ -285,7 +285,7 @@ proto.update = function(data) {
285285
}
286286

287287
if(true) {
288-
var delaunayOptions = calculateMesh(this.data.x, this.data.y, this.data.z, options.lineColor, options.scatterColor, this.scene.dataScale);
288+
var delaunayOptions = calculateMesh(this.data.x, this.data.y, this.data.z, options.lineWidth, options.lineColor, options.scatterSize, options.scatterColor, this.scene.dataScale);
289289
if(this.delaunayMesh) {
290290
this.delaunayMesh.update(delaunayOptions);
291291
} else {
@@ -324,7 +324,7 @@ function createLineWithMarkers(scene, data) {
324324

325325
module.exports = createLineWithMarkers;
326326

327-
function calculateMesh(inputX, inputY, inputZ, inputC, inputMC, scalingFactor) {
327+
function calculateMesh(inputX, inputY, inputZ, inputW, inputC, inputMW, inputMC, scalingFactor) {
328328

329329
function addVertex(X, Y, Z, x, y, z) {
330330
X.push(x);
@@ -837,11 +837,13 @@ function calculateMesh(inputX, inputY, inputZ, inputC, inputMC, scalingFactor) {
837837

838838
var p = makeCircularSampleModel();
839839

840+
var scaler =0.01;
841+
840842
p = {
841843
x: inputX,
842844
y: inputY,
843845
z: inputZ,
844-
r: inputX.map(function(d) {return 0.05}),
846+
r: Array.isArray(inputW) ? inputW * scaler: inputX.map(function() {return inputW * scaler}),
845847
c: inputC
846848
}
847849

@@ -854,21 +856,27 @@ function calculateMesh(inputX, inputY, inputZ, inputC, inputMC, scalingFactor) {
854856
};
855857

856858
var upsamplingFactor = 100; // convert every original point to as many upsampled points
857-
for(n = 0; n < p.x.length - 3; n++) {
859+
var n0, n1, n2, n3;
860+
for(n = 0; n < p.x.length - 1; n++) {
858861

859862
for(var m = 0; m < upsamplingFactor; m++) {
860863

861864
c1 = m / upsamplingFactor;
862865
c2 = (upsamplingFactor - m) / upsamplingFactor;
863866

867+
n0 = (n - 1 + p.x.length) % p.x.length;
868+
n1 = n;
869+
n2 = (n + 1) % p.x.length;
870+
n3 = (n + 2) % p.x.length;
871+
864872
var xyzrf = catmullRom(
865-
[p.x[n], p.x[n + 1], p.x[n + 2], p.x[n + 3]],
866-
[p.y[n], p.y[n + 1], p.y[n + 2], p.y[n + 3]],
867-
[p.z[n], p.z[n + 1], p.z[n + 2], p.z[n + 3]],
868-
[p.r[n], p.r[n + 1], p.r[n + 2], p.r[n + 3]],
869-
[p.c[n][0], p.c[n + 1][0], p.c[n + 2][0], p.c[n + 3][0]],
870-
[p.c[n][1], p.c[n + 1][1], p.c[n + 2][1], p.c[n + 3][1]],
871-
[p.c[n][2], p.c[n + 1][2], p.c[n + 2][2], p.c[n + 3][2]],
873+
[p.x[n0], p.x[n1], p.x[n2], p.x[n3]],
874+
[p.y[n0], p.y[n1], p.y[n2], p.y[n3]],
875+
[p.z[n0], p.z[n1], p.z[n2], p.z[n3]],
876+
[p.r[n0], p.r[n1], p.r[n2], p.r[n3]],
877+
[p.c[n0][0], p.c[n1][0], p.c[n2][0], p.c[n3][0]],
878+
[p.c[n0][1], p.c[n1][1], p.c[n2][1], p.c[n3][1]],
879+
[p.c[n0][2], p.c[n1][2], p.c[n2][2], p.c[n3][2]],
872880
c1);
873881

874882
rp.x.push(xyzrf[0]);
@@ -914,7 +922,7 @@ function calculateMesh(inputX, inputY, inputZ, inputC, inputMC, scalingFactor) {
914922
}
915923

916924
for(n = 0; n < p.x.length; n++) {
917-
index = addPointMarker(unitSphere, p.x[n], p.y[n], p.z[n], inputMC[n], 0.1, index, X, Y, Z, I, J, K, F);
925+
index = addPointMarker(unitSphere, p.x[n], p.y[n], p.z[n], inputMC[n], scaler / 2 * (Array.isArray(inputMW) ? inputMW[n] : inputMW), index, X, Y, Z, I, J, K, F);
918926
}
919927

920928
return {

0 commit comments

Comments
 (0)