简体   繁体   English

three.js-在管几何周围创建立方体

[英]three.js - create cube around tube geometry

Please find the URL for tube geometry: 3d tube with 200 points of data passed in JSON format. 请找到试管几何的URL: 3d试管,其中200点数据以JSON格式传递。

As number of points vary for the length of the tube, how do I create a transparent cube around tube geometry dynamically to cover entire tube structure inside the cube and the whole scene look like a pipe inside a surface ? 当点的数量随管的长度而变化时,如何围绕管的几何形状动态创建一个透明立方体,以覆盖立方体内部的整个管结构,并且整个场景看起来像曲面内的管道?

geometry.computeboundingbox() which adjusts the scale at which the box is and postion of where the box should be placed geometry.computeboundingbox()调整框所在的比例以及应放置框的位置

scaleX = (max.x -min.x);
scaleY = (max.y -min.y);
scaleZ = (max.z -min.z);

positionX = min.x + scaleX/2;
positionY = min.y + scaleY/2;
positionZ = min.z + scaleZ/2;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM