给定3个动态点,定位平面以使其与所有3个点相交的最佳方法是什么?
我正在使用Three.js
答案 0 :(得分:2)
创建几何体。为每个点添加顶点,然后创建一个面。例如:
var geometry = new THREE.Geometry();
geometry.vertices.push(new THREE.Vector3(0,0,0));
geometry.vertices.push(new THREE.Vector3(1,1,0));
geometry.vertices.push(new THREE.Vector3(1,-1,0));
geometry.faces.push( new THREE.Face3( 0, 1, 2 ) );
geometry.dynamic = true;
var shapeMesh = new THREE.Mesh(geometry, material);
scene.add(shapeMesh);
每次更改几何图形时,请务必让three.js知道:
geometry.verticesNeedUpdate = true;
geometry.elementsNeedUpdate = true;
答案 1 :(得分:1)
要获取矢量的方向以定向平面,请计算三角形中任意两边的叉积
所以,如果你的积分是a,b,c
side1 = subVectors (a, b);
side2 = subVectors (a, c);
planeNormal = crossVectors (side1, side2);