-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from rhyolight/cleanup
Cleaning up and doccing
- Loading branch information
Showing
4 changed files
with
73 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/** | ||
* This interface is used to update cell data within the SpToInputVisualization. | ||
* Once created, use it to update cell values. | ||
* @param {Layer} layer - from Highbrow. | ||
*/ | ||
function HtmHighbrowLayer(layer) { | ||
this.layer = layer | ||
this.dimensions = layer.getDimensions() | ||
} | ||
|
||
HtmHighbrowLayer.prototype.getX = function() { | ||
return this.dimensions.x | ||
}; | ||
|
||
HtmHighbrowLayer.prototype.getY = function() { | ||
return this.dimensions.y | ||
}; | ||
|
||
HtmHighbrowLayer.prototype.getZ = function() { | ||
return this.dimensions.z | ||
}; | ||
|
||
/** | ||
* Gets the value of the cell given the coordinates. | ||
* @param x (int) x coordinate | ||
* @param y (int) y coordinate | ||
* @param z (int) z coordinate | ||
* @returns {*} whatever value was in the cell | ||
*/ | ||
HtmHighbrowLayer.prototype.getCellValue = function(x, y, z) { | ||
let neuronState = this.layer.getNeuronByXyz(x, y, z).state | ||
let out = { state: neuronState } | ||
if (neuronState == "inactive") { | ||
out.color = new THREE.Color('#FFFEEE') | ||
} else { | ||
out.color = new THREE.Color('orange') | ||
} | ||
return out; | ||
}; | ||
|
||
/** | ||
* Send in one object to update the whole layer state. If the data doesn't match | ||
* the structure of the layer, bad things will probably happen. | ||
*/ | ||
HtmHighbrowLayer.prototype.update = function(data) { | ||
this.network.update(data) | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters