The tube sample code generates a tube from an equation. That doesn’t help me. I need to generate a tube from an array of x-y-z coordinates. I don’t have any idea of what the “control point” would be and I hope I don’t need one. May I please see sample code for creating a tube from an array rather than an equation?
like this?
What coordinates of the tube do you have. Without an example, it is difficult to give a meaningful answer.
Here are some sample points:
Pt# X Y Z
0: {-640, 641, -155}
1: {-641, 600, -155}
2: {-641, 569, -156}
3: {-641, 537, -156}
4: {-641, 506, -155}
5: {-641, 475, -155}
6: {-643, 444, -153}
7: {-646, 413, -151}
8: {-648, 392, -149}
Interesting, but again, the path needs to be based on point coordinates, not a formula.
How does the desired result have to look like? Any reference picture(s)?
The link that @makc3d posted shows exactly how point coordinates are used to make a tube. Namely, the set of points defines an extrusion path for the tube. If this is not what you want, then provide more details as @prisoner849 suggested.
You are correct that the link from @makc3d shows the RESULTS of extruding a tube, but it does not show the source code. I cannot tell if the purple tube was generated from an equation, as seems likely, or whether a list of THREE.Vector3 points was used. I need to use a list of THREE.Vector3 points. Somehow I should be able to provide that list as an array to a path object, and then pass that path to the tube constructor.
The link posted by @makc3d shows a purple tube. That’s the idea.
I see your confusion. When you go to the example, click on the (<>)
button in the lower-right corner. This will open the source code. Lines 79-85 are the list of points that are converted into a 3D curve that is used to extrude the tube profile.
const closedSpline = new THREE.CatmullRomCurve3( [
new THREE.Vector3( - 60, - 100, 60 ),
new THREE.Vector3( - 60, 20, 60 ),
new THREE.Vector3( - 60, 120, 60 ),
new THREE.Vector3( 60, 20, - 60 ),
new THREE.Vector3( 60, - 100, - 60 )
] );
Thank you, @PavelBoytchev. Your information pointed me to the solution!