Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.

First time visiting? Here are some places to start:
  1. Looking for a certain topic? Check out the categories filter or use Search (upper right).
  2. Need support? Ask a question to our Community Support category.
  3. Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
  4. Be respectful, on topic and if you see a problem, Flag it.

If you would like to contact our Community Manager personally, feel free to send a private message or an email.

Curves and Surfaces

S1monS1mon Member Posts: 2,987 PRO
If you've ever wanted to know more about the basic math behind the curves and surfaces which drive CAD models, here's an amazing interactive web page about them:
https://ciechanow.ski/curves-and-surfaces/

One thing I'm stuck by is how fluid and interactive even the more complex 3D surface mini-apps are on the page. I'm pretty sure this is all running in the browser. Is there any good reason we can't have this level of interactivity and power with high-degree Bézier curves and surfaces in Onshape?

Comments

  • ilya_baranilya_baran Onshape Employees, Developers, HDM Posts: 1,214
    That's a very nice page -- I've taught this stuff as part of a graphics class at ETH Zurich and my demos definitely weren't as slick. I haven't read the explanations to see how intuitive they are, but I really like the aesthetic and interactivity of the illustrations!  It is all running in the browser.

    There is a very big difference between what is on that page and what is needed for a CAD system.  Every illustration on the page is just a bunch of spline evaluations.  The "power" is minimal.  Even for a high-order NURBS, evaluation with deBoor's algorithm is very cheap.  For CAD, however, you need trimmed surfaces stitched into watertight (up to tolerance) bodies, adaptive tessellation, fitting (which involves nonlinear equation solving if you're not given knots and parameters), distance computations (again, nonlinear equations), intersections, etc.  Those algorithms are both much more complicated, as far as implementation goes, and more expensive, as far as performance.  That is why we use Parasolid, our geometric kernel to do a lot of the heavy lifting.

    If all you want to do is drive a Bezier or B-spline by control points, there's nothing stopping us from doing an interactive in-browser preview mechanism, other than we haven't gotten to it yet because of many other priorities.  For something like our fill operation, though, with complicated boundary constraints, we need to round-trip to the kernel, and do serious back-end computation, so that's not going to be quite as fluid.
    Ilya Baran \ VP, Architecture and FeatureScript \ Onshape Inc
  • S1monS1mon Member Posts: 2,987 PRO
    @ilya_baran

    I'll admit I haven't gotten around to reading it word for word yet either. I did note that he uses G0, G1, G2, when he's showing things that are C0, C1, C2 and he didn't explain the distinction. 

    But I guess what struck me is how fluidly the curvature combs update compared with Onshape, either as splines or a bridging curve (which at most is a degree 5 Bézier). 

    Another simple example - drag one of the CVs around in this applet (part way down the page) :


    I made a simple sketch in an Onshape doc and dragging a simulated CV - without a Bézier spline - in a similar De Casteljau construction updates sooo much slower. I realize it's running the D3 solver, but this is a relatively simple sketch. (make a copy, edit the sketch and drag the point with the small circle)



    Maybe there's some fundamental thing in Onshape which is set to update at a lower frame rate in order to limit calls to the server? I don't know what's going on under the hood, but the lag/frame rate really makes it harder to feel like you have interactive control over curves and surfaces.
  • EvanReeseEvanReese Member, Mentor Posts: 2,141 ✭✭✭✭✭
    holy crap that site is awesome! thanks for sharing.
    Evan Reese
  • ilya_baranilya_baran Onshape Employees, Developers, HDM Posts: 1,214
    @S1mon
    Interesting, when I copy your document and drag by the vertex, I get a very smooth drag in Onshape (except snapping due to constraint inferencing).  For this type of sketch solving, we can drag at a higher framerate than our rate of calling the server.  So, if you're not seeing a smooth drag, it's worth making sure there's no performance issue with your local machine -- either the dedicated GPU is not being used, or something else is not right.
    Ilya Baran \ VP, Architecture and FeatureScript \ Onshape Inc
  • S1monS1mon Member Posts: 2,987 PRO
    @ilya_baran
     
    I have a 2015 MacBook Pro. I've been using Onshape in Chrome as the performance in Safari has been a little lacking (Chrome shows that it's using the OpenGL Engine). If I move stuff in Onshape slowly, it's fine, but sometimes I can move things quickly enough that I see a big lag and the frame rate is not great. The "ctrl-D" inspector shows a decent frame rate for 3D spinning of models. 

    I tried the same De Casteljau construction exercise today, and I'm not seeing the same difference I thought I was seeing yesterday. Either something else with my system load has changed or I'm crazy. Editing the magnatude of a Bridging curve with the Curvature turned on is still very laggy.

    I also have a M1 Max MacBook Pro on order. This will hopefully make some of these complaints moot.




  • billy2billy2 Member, OS Professional, Mentor, Developers, User Group Leader Posts: 2,068 PRO
    I did read the link and it's really well done. Thanks for the link. 

    I've never known why we've needed Bézier curves and have only known b-splines. I've always felt like I could design any shape with a 2 noded spline.

    I've played with sub-divisional surfacing and it's fun:

    This thing is really cool to play with.

    But, I always go back to bi-cubic polynomials & trimmed surfaces to get things done.

    I did work at a mountain bike manufacturer for a while and their designs were created in t-splines. It seemed really quick to create a carbon fiber frame but in the end they couldn't make the changes needed for manufacturing. My job was to the make the geometry production worthy which I did in solidworks and just edited their imported surfaces to make something manufacturable.

    I don't think overall it was faster to use t-splines, they had to create all the frame sizes individually. For them to create one bike size was fast, but all the sizes took a long time: CAD time * 4 sizes. 
    I'm not saying I could have created a parametric bike frame with unlimited change capability, but I did want to give it a try. After creating the t-spline concepts, I think I could have gotten us to fabrication faster using parametrics.

  • EvanReeseEvanReese Member, Mentor Posts: 2,141 ✭✭✭✭✭
    @billy2
    that's interesting about the bike frames and t-splines. T-splines was bought by autodesk and integrated with Fusion 360, and removed from Rhino. Since then Rhino has added sub-d tools natively. Now that Rhino has it built in, it should be possible to make a parametrically updateable sub-d bike frame using Rhino and Grasshopper to get all frame sizes from a single model. I'd still want to do my main finishing stuff in Onshape though depending on what it was.
    Evan Reese
  • S1monS1mon Member Posts: 2,987 PRO
    @billy2

    Depending on the degree and number of knots (spans) in a b-spline, it's the same thing as a Bézier. B-splines are a superset of Béziers, and NURBS are a superset of B-splines. NURBS allow non-uniform weighting of the control points, which enables perfect arcs and ellipse - uniform weighted B-splines and Béziers can only approximate arcs and ellipses. 

    With a degree 3 Bézier or single span (no internal points in Onshape) b-spline, it can generally only be G2 at one end. Degree 5 allows G2 at both ends. (In special cases of the driving curves/surfaces, a degree 3 or 4 could be G2 or even G3 at both ends). Degree 7 allows G3 at both ends. G3 is what makes it so that it's not really possible for a person to see where each surface begins and ends based on the continuity of the reflections. Not every consumer product has class-a surfacing, but cars and a decent amount of higher end products require it.
  • billy2billy2 Member, OS Professional, Mentor, Developers, User Group Leader Posts: 2,068 PRO
    @Evan_Reese it was a while back when t-splines was in rhino. The one thing that was jaw-dropping was the bike's bottom bracket, it looked really good coming out of t-splines. I'm glad I didn't have to recreate it inside SW. Do you work with sub-d stuff? 

    @S1mon I don't create car fenders and large complex designs. I've done a lot of handheld devices, medical equipment, automation and really cool motorcycle stuff. I rarely use G2 continuity because it fails more often than G1. Controlling the rate of change of curvature (G3) for larger patches and complex designs seems like a good idea. Do you have any examples that needed G3? Would it really make my 3D printed parts look that much better?

    I get your point, in some case G3 is needed. 

    Here's G2 continuity in onshape on both ends of the surface loft:


    I get the idea of a mesh of control points for a surface and then controls/weights for how much each point controls the generation of the underlying curves/surfaces, but is this too much? 

    The one thing about Bézier curves that turns me off is that moving one control points re-evaluates the whole curve. I think splines are more suited for my designs because moving a node is more localized which seems more what I want. 

    Can you please post some examples of parametric shapes controlled with Bézier curves, I would like to see what I'm missing out on.


  • EvanReeseEvanReese Member, Mentor Posts: 2,141 ✭✭✭✭✭
    billy2 said:
    @Evan_Reese it was a while back when t-splines was in rhino. The one thing that was jaw-dropping was the bike's bottom bracket, it looked really good coming out of t-splines. I'm glad I didn't have to recreate it inside SW. Do you work with sub-d stuff? 

    ...

    Would it really make my 3D printed parts look that much better?
    I've done an electric bike frame with sub-d, but that's about it aside from fiddling around on the side. The results can be pretty great when the modeler really knows what they're doing though.

    My understanding is you get the most value out of higher levels of continuity especially for glossy products. I don't think it would make much difference on a 3D print. If you pay close attention to your curvature combs it's possible to get curves that are visually (but probably not mathematically) C3 in Onshape, which is plenty for my day-to-day. If I need something with more control than that I'd use Rhino.
    Evan Reese
  • billy2billy2 Member, OS Professional, Mentor, Developers, User Group Leader Posts: 2,068 PRO
    edited November 2021
    @Evan_Reese I think you're right.

    Some other thoughts about C3, I was thinking about last night, the size of the object you're designing. My parts are usually small and I turn off C2 just for robustness. I think a large object like the hood of a car could use C3 and make a cosmetic difference. You have to be designing big stuff for it to matter.

    I've used t-splines in fusion and I've played with Phi (offered as a OS extension), but, until these guys integrate it natively into my CAD, I'm not going to use it. You create your layout in OS, then pass it Phi, and then bring it back into the design. It's 2021, I'm not going to transfer geometry around like that.

    Most the sub-d examples allow you to create a marshmallow which I'm not interested, better examples might help. I wish I had a picture of the bike's bottom bracket. When I saw it I thought I needed to learn sub-d, I don't think I could've re-created it in SW.

    Maybe PTC can buy rhino and let's make a real sub-d extension inside OS? I think sub-d has to integrated to become a useful design tool. 

     

  • EvanReeseEvanReese Member, Mentor Posts: 2,141 ✭✭✭✭✭
    I agree it can also have to do with size. I'm definitely not doing any .5mm fillets with curvature turned on  :D.

    PTC already has the same kind of thing in Creo called "Freeform Surfacing", which I'd love to see integrated into Onshape. There's always the Power Surfacing plugin for Solidworks.
    Evan Reese
  • S1monS1mon Member Posts: 2,987 PRO
    I've heard that below 3mm, even Apple doesn't do G2 or G3 fillets, but that's probably BS (as counter example, the plastic shell on a lightning cable end is almost elliptical in section because of how much they smoothed out something which is nominally a racetrack/slot shape).

    In any case, it really depends a lot on ID preference, the production methods, finishes, and how the object will be seen/used. Early in my career I accidentally left two surfaces which should have been continuous with a 2 degree dihedral that went to tooling. By the time the injection mold tool was built, you couldn't see it at all. I put that down to polishing and texturing. On the other hand I've observed small ripples in surfaces in CAD using zebras, and sure enough, they showed up in the real parts (thankfully not my CAD).

    PTC already has some decent looking Sub-D technology in Creo (it was introduced 10 years ago).

    PTC also has a very good set of more traditional curves and surfacing tools in the Style feature (aka ISDX, which evolved from their acquisition of CDRS from Evans and Sutherland in the 90's). The way that a bunch of curves and surfaces can be interrelated in one feature is really pretty brilliant. It's more like how 2D sketches and constraints are solved "simultaneously" in Onshape, Solidworks or Creo. You can build adjacent surfaces in ISDX and as long as you don't try to create some sort of circular reference, you can flip and rearrange which surfaces/curves influence each other to your heart's content. You can even say that two surfaces influence each other (i.e. you set mutual G2 and they both change internally to get the best version of G2 at the mutual boundary). I've built a lot of models in ISDX for major corporate clients. It's still a great tool. Considering that ISDX was running smoothly on PCs back in the 90's, there's no reason we can't have that level of control in a browser in Onshape now.
  • billy2billy2 Member, OS Professional, Mentor, Developers, User Group Leader Posts: 2,068 PRO
    edited November 2021
    OS, how do we connect these openings?

    This is the bottom bracket problem:

    How do you get all these openings to connect? I forgot the designer's name, but his was a thing of beauty.

    This is my 5 minute solution and it looks like something you'd buy at a dime store:


    If there's any sub-d guys out there, please show us how it's done.

    The t-splines solution gorgeous.

    Maybe there's a featurescript that can accept openings and construct a manifold?


  • EvanReeseEvanReese Member, Mentor Posts: 2,141 ✭✭✭✭✭
    @billy2
    will you share that doc? I may wanna take a crack at it sometime as a challenge.
    Evan Reese
  • billy2billy2 Member, OS Professional, Mentor, Developers, User Group Leader Posts: 2,068 PRO
    edited November 2021
    Give me a second, it's in my house design. Let me move it out and I'll share it public.

    Here you go, I made it public and shared with OS support.

    https://cad.onshape.com/documents/7fb41efc3e90820ffcb95eca/w/8538cad1400bf7739a959cb5/e/5874d342887b40846addfbc7

    Watch some high school kid show us how it's done. Let's hope.
Sign In or Register to comment.