Trim Surface With A Curve

Hi Guys,

I’m trying a trim a parametric surface (made via NURBS Geometry) with a separate curve. Does anybody know how I can go about doing this? I’m confused as to where to start. Would appreciate any help!

Thanks,
Amit

When you talking about trimming, I guess you are looking for a similar effect like when using clipping planes?

https://threejs.org/examples/webgl_clipping

If so, I’m afraid there is no easy way to implement this with a custom NURBS surface.

Hi Mugen, thats right clipping but with curves. Do you know of a hard way to do it? I’m willing to get it done any way possible

No sorry, I’ve never seen something like this done.

Do appreciate the suggestions though

In both this question and Whats The Best Way to Convert Surface of Points to a Surface?, it seems like you may be looking for a modeling program rather than a rendering library… Creating complex parametric surfaces with code is a more advanced topic and often requires a fair bit of math. In many cases it’s easier to create the shapes you want in a free program like Blender, export them to glTF, and then load that into three.js.

Hey Don,

Thanks for taking notice. Basically I am working on a project to read STEP files to three.js. I am able to render almost all surface type except NURBS surfaces. The STEP file defines the NURBS surface but seperately defines edge bounds to the surface. I am trying to find an adequate way to display a NURBS surface that is trimmed according to edge curves/bounds as defined in a STEP file. If you see the graphics of my last response in this thread: How To Make Curved Surfaces, you can better understand what I am trying to say

I have no experience with STEP. But maybe you can use a similar procedure on the edge as it is done in triangulation according to E. Hartmann.

I have realized it for implicit surfaces and also explicit forms.

See

Addon for triangulation of implicit surfaces/ forms with holes

https://github.com/hofk/THREEi.js

The geometry manipulation of NURBS geometry is a pretty complex. Don’t think NURBS themselves support clipping. Commonly they’re hosted in a data-structure called Boundary Representations (BReps), which does something like a masking to show clipped surfaces.
Easiest way to make it work online with threejs that I’m aware of might be an experimental McNeel project based on OpenNURBS.