Hi there!
I am working on a proof of concept mixing rhino3dm.js, Three.js and Y.js to create a p2p collaborative Grasshopper-like application in the browser (you can play with two open browser windows to see them interact): Link to prototype
The way I reconstruct Breps in Three.js at the moment is by getting the points of each face and making a ConvexGeometry with the point cloud:
export function faceToPoints(face) {
const points = [];
const loops = 20;
face.setDomain(0, [0, 1]);
face.setDomain(1, [0, 1]);
for (let u = 0; u <= loops; u++) {
for (let v = 0; v <= loops; v++) {
const point = face.pointAt(u / loops, v / loops);
points.push(new THREE.Vector3(point[0], point[1], point[2]));
}
}
return points;
}
Right now the NurbsSuface instance in rhino3dm.js is missing some of the methods available in the python library, like getting the control points, knots etc.
I noticed that Threejs has support for NURBS surfaces. And so being able to get the control points would hopefully make it easier to convert faces of a Brep to a Threejs representation, instead of the manual way I’m doing it now.
Until then, does anyone know better ways to reconstruct a surface based on points on a surface in Three.js? I was trying with the delunator, but it only really works in 2d, or a 3d surface that does not “wrap” over itself. I have looked into the Ball Pivot algorithm, but couldn’t find any wasm port or javascript implementation. Also I have no previous experience in this 3D stuff, so I feel a bit stuck at this point.