Three.js内の点の集合を通して最小自乗平面を描こうとしています。私は次のように定義されたplaneを持っている:Three.js - Math.PlaneのPlaneGeometry
var plane = new THREE.Plane();
plane.setFromNormalAndCoplanarPoint(normal, point).normalize();
私の理解では、私はその飛行機に乗ると、表示のためにシーンに追加するメッシュを作成するために、ジオメトリを思い付くためにそれを使用する必要があるということです。
var dispPlane = new THREE.Mesh(planeGeometry, planeMaterial);
scene.add(dispPlane);
私はthis answerを適用してジオメトリを取得しようとしていました。私が間違っている可能性が場所を示すために
plane.setFromNormalAndCoplanarPoint(dir, centroid).normalize();
planeGeometry.vertices.push(plane.normal);
planeGeometry.vertices.push(plane.orthoPoint(plane.normal));
planeGeometry.vertices.push(plane.orthoPoint(planeGeometry.vertices[1]));
planeGeometry.faces.push(new THREE.Face3(0, 1, 2));
planeGeometry.computeFaceNormals();
planeGeometry.computeVertexNormals();
しかし、平面が全く表示され、エラーがないされていません。これは私が思い付いたものです。
私の質問は、Math.Planeオブジェクトをどのようにしてメッシュのジオメトリとして使用できるのですか?
planeMaterialはどのように見えますか?あなたはplaneMaterial.sideを変更しようとしましたか?例えば、planeMaterial.side = THREE.DoubleSide – msun
var planeMaterial = new THREE.MeshLambertMaterial({color:0xffff00、side:THREE.DoubleSide}); –
私は頂点としてplane.normalを使用していることに気付きました:例えば、planeGeometry.vertices.push(plane.normal);それは有効ではないようです。代わりにplane.coplanarPoint()を使用すると運がいいですか? – msun