Within a scene constructed from JSON data, I have a tube geometry that requires a line marker at each segment. To achieve this, I am using the centroid of a face as the starting point and adding 10 to each coordinate of the centroid for the end point of the line.
You can view an example of a tube with a line here.
Below is the code snippet for adding a line from the center of a face:
var lineGeo, lineMat, line;
var fx = tube.faces[3].centroid.x;
var fy = tube.faces[3].centroid.y;
var fz = tube.faces[3].centroid.z;
lineGeo = new THREE.Geometry();
lineGeo.vertices.push(new THREE.Vector3(fx, fy, fz), new THREE.Vector3(fx+50, fy+50, fz + 50));
lineMat = new THREE.LineBasicMaterial({color: 0x000000, lineWidth: 2});
line = new THREE.Line(lineGeo, lineMat);
line.type = THREE.Lines;
tubeMesh.add(line);
My next challenge is how to add text at the end of a line. In a live environment, the tube consists of 2000 coordinates with 200 lines serving as markers. I need to include text at the end of each marker (line).