ThreeJS连接到各种坐标

时间:2016-10-05 23:09:29

标签: three.js

您好我有一个包含许多xyz坐标点的外部文件。在我的threeJS文件中,我将这些点用作顶点并推送到几何体并创建点云。然而,结果看起来像许多点散布在周围。你是如何连接这些点的,以便它们比现在更具连接性?这是我的代码。

var dataxyz = xyz; 
//xyz is a variable that is an array containing all xyz  coordinates.
var particleCount=Object.keys(dataxyz).length;
var coOef =100;
for (var i=0;i<particleCount;i++) {

        var coOrd=dataxyz[i];
        var vertex = new THREE.Vector3();
        vertex.x = coOrd[0] * coOef;
        vertex.y = coOrd[2] * coOef-(coOef*2.5);
        vertex.z = coOrd[1] * coOef;

    }
var Size = 0.1;
this.materials= new THREE.PointCloudMaterial({size: Size});
this.particles = new THREE.PointCloud(this.geometry, this.materials);
this.scene.add(this.particles);

0 个答案:

没有答案