@@ -20,7 +20,6 @@ var str2RgbaArray = require('../../lib/str2rgbarray');
2020
2121var MIN_RESOLUTION = 128 ;
2222
23-
2423function SurfaceTrace ( scene , surface , uid ) {
2524 this . scene = scene ;
2625 this . uid = uid ;
@@ -136,7 +135,7 @@ function refine(coords) {
136135 Math . floor ( ( coords [ 0 ] . shape [ 1 ] ) * scaleF + 1 ) | 0 ] ;
137136 var nsize = nshape [ 0 ] * nshape [ 1 ] ;
138137
139- for ( var i = 0 ; i < 3 ; ++ i ) {
138+ for ( var i = 0 ; i < coords . length ; ++ i ) {
140139 var padImg = padField ( coords [ i ] ) ;
141140 var scaledImg = ndarray ( new Float32Array ( nsize ) , nshape ) ;
142141 homography ( scaledImg , padImg , [ scaleF , 0 , 0 ,
@@ -230,9 +229,6 @@ proto.update = function(data) {
230229 } ) ;
231230 }
232231
233- //Refine if necessary
234- this . dataScale = refine ( coords ) ;
235-
236232 var params = {
237233 colormap : colormap ,
238234 levels : [ [ ] , [ ] , [ ] ] ,
@@ -249,10 +245,30 @@ proto.update = function(data) {
249245 dynamicColor : [ [ 1 , 1 , 1 , 1 ] , [ 1 , 1 , 1 , 1 ] , [ 1 , 1 , 1 , 1 ] ] ,
250246 dynamicWidth : [ 1 , 1 , 1 ] ,
251247 dynamicTint : [ 1 , 1 , 1 ] ,
252- opacity : 1 ,
253- colorBounds : [ data . zmin * scaleFactor [ 2 ] , data . zmax * scaleFactor [ 2 ] ]
248+ opacity : 1
249+ // TODO: Need to think about how to calculate this
250+ /*
251+ intensityBounds: [
252+ data.zmin * scaleFactor[2],
253+ data.zmax * scaleFactor[2]]
254+ */
254255 } ;
255256
257+ //Refine if necessary
258+ if ( 'intensity' in data ) {
259+ var intensity = ndarray (
260+ new Float32Array ( xlen * ylen ) , [ xlen , ylen ] )
261+ fill ( intensity , function ( row , col ) {
262+ return data . intensity [ col ] [ row ]
263+ } )
264+ coords . push ( intensity )
265+ }
266+
267+ this . dataScale = refine ( coords ) ;
268+
269+ if ( 'intensity' in data ) {
270+ params . intensity = coords . pop ( )
271+ }
256272
257273 if ( 'opacity' in data ) {
258274 if ( data . opacity < 1 ) {
@@ -300,6 +316,8 @@ proto.update = function(data) {
300316 }
301317
302318 params . coords = coords ;
319+
320+
303321 surface . update ( params ) ;
304322
305323 surface . highlightEnable = highlightEnable ;
0 commit comments