Last active
January 25, 2018 14:17
-
-
Save mattearnshaw/c22427ff7c91e843b6248d185fc41131 to your computer and use it in GitHub Desktop.
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
create3DCylinderFromNode: function (cylNode, material, minRadius, maxRadius) { | |
var bottomBasePos = new THREE.Vector3(cylNode.position.x, cylNode.position.y, cylNode.position.z); | |
var topBasePos = new THREE.Vector3(cylNode.distal.x, cylNode.distal.y, cylNode.distal.z); | |
var topRadius = cylNode.topRadius; | |
var bottomRadius = cylNode.bottomRadius; | |
var axis = new THREE.Vector3(); | |
axis.subVectors(topBasePos, bottomBasePos); | |
var c = new THREE.CylinderGeometry(topRadius, bottomRadius, axis.length(), 20, 1, false); | |
var threeObject = new THREE.Mesh( c, material ); | |
return threeObject; | |
}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment