I'm currently working on generating a least squares plane through a set of points in Three.js. I've defined a plane as shown below:
var plane = new THREE.Plane();
plane.setFromNormalAndCoplanarPoint(normal, point).normalize();
My understanding is that I'll need to utilize this plane to create a Geometry in order to construct a mesh for visualization within the scene:
var dispPlane = new THREE.Mesh(planeGeometry, planeMaterial);
scene.add(dispPlane);
I've attempted to follow the guidance provided in this answer to generate the geometry. Here's what I have so far:
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();
Despite following these steps, the plane isn't being displayed and there are no error messages pointing out potential mistakes.
Therefore, my question is: How can I use my Math.Plane object to create a suitable geometry for a mesh?