Skip to content

Commit 113313c

Browse files
committed
partial color transfer (points)
1 parent 4395051 commit 113313c

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/traces/streamtubes/convert.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -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, this.scene.dataScale);
288+
var delaunayOptions = calculateMesh(this.data.x, this.data.y, this.data.z, options.lineColor, 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, scalingFactor) {
327+
function calculateMesh(inputX, inputY, inputZ, inputC, scalingFactor) {
328328

329329
function addVertex(X, Y, Z, x, y, z) {
330330
X.push(x);
@@ -788,9 +788,8 @@ function calculateMesh(inputX, inputY, inputZ, scalingFactor) {
788788
}
789789

790790
function colorer(d) {
791-
return d;
792-
var colorArray = [Math.round(255 * d), 0, Math.round(255 * (1 - d))];
793-
return 'rgb(' + colorArray.join() + ')';
791+
var colorArray = [d, 0, 1 - d];
792+
return colorArray;
794793
}
795794

796795
function makeCircularSampleModel() {
@@ -831,7 +830,7 @@ function calculateMesh(inputX, inputY, inputZ, scalingFactor) {
831830
y: inputY,
832831
z: inputZ,
833832
r: inputX.map(function(d) {return 0.05}),
834-
c: inputX.map(function(d) {return 1})
833+
c: inputC
835834
}
836835

837836
var rp = {
@@ -901,7 +900,7 @@ function calculateMesh(inputX, inputY, inputZ, scalingFactor) {
901900
}
902901

903902
for(n = 0; n < p.x.length; n++) {
904-
index = addPointMarker(unitSphere, p.x[n], p.y[n], p.z[n], 'rgb(64,64,255)', 0.1, index, X, Y, Z, I, J, K, F);
903+
index = addPointMarker(unitSphere, p.x[n], p.y[n], p.z[n], [64/255,64/255,255/255], 0.1, index, X, Y, Z, I, J, K, F);
905904
}
906905

907906
return {
@@ -911,7 +910,8 @@ function calculateMesh(inputX, inputY, inputZ, scalingFactor) {
911910
Z[i] * scalingFactor[2]
912911
]}),
913912
cells:I.map(function(d, i) {return [I[i], J[i], K[i]]}),
914-
meshColor: [0.12156862745098039,0.4666666666666667,0.9058823529411765,1],
913+
cellColors: F,
914+
// meshColor: [0.12156862745098039,0.4666666666666667,0.9058823529411765,1],
915915
opacity: 1,
916916
lightPosition: [1e6 * scalingFactor[0], 1e6 * scalingFactor[1], 1e6 * scalingFactor[2]],
917917
ambient: 0,

0 commit comments

Comments
 (0)