Determining Surface Type (Plane, Cylinder, Cone, Sphere) in Rhino3dm.js

Hi everyone,

I’m new to Rhino, and I would like to analyze a Brep face from my Three.js model using Rhino3dm.js.

I have a list of points and triangles that form a surface, and I want to determine whether the surface is a plane, cylinder, cone, or sphere.

My idea was to create a NurbsSurface or a BrepFace in rhino3dm.js and then use functions like isSphere(), isCylinder(), or isCone() to classify the surface.

However, as I understand it, the main challenge is that I need to define all parameters of a NurbsSurface, including:

  • u_count, v_count
  • degree
  • Control points
  • Knots

Could anyone guide me on the best approach to achieve this? Any advice would be greatly appreciated!

Thanks in advance!

Hi @Mi_Ly,

A list of points and triangles form a polygon mesh, which is quite different than a NURBS surface.

Rhino3dm does not contain function to convert a faceted mesh into a smooth NURBS surface.

– Dale

Hello @dale ,

Thank you for your reply, I appreciate it!

I considered using NurbsSurface because it provides functions like isCylinder(), isCone(), isPlane(), and isSphere().

Do you have any idea how to determine the surface type (Plane, Cone, Cylinder, Sphere) from a list of points or a mesh’s triangles from threejs using rhino3dm.js?

Mike

There are no functions in rhino3dm.js to determine if a mesh conforms to any of those surface types.

Are you creating these mesh cones, spheres, cylinders, etc in three.js? If you are in control of the code which creates these meshes in three.js, you could add their parameters as userData to the object in threejs such that you could recreate these with rhino3dm.js as nurbs surfaces.

Hello @fraguada!

Thank you for your reply.

Unfortunately, I have no control over the creation of the mesh in Three.js. I am importing a 3D object into JavaScript and would like to analyze its surfaces.

The object could be any type of complex 3D shape, composed of points (vertices) and triangles. My main goal is to determine the type of surface from the points that define it.

This is an interesting but non-trivial problem you are trying to solve. Good luck!