Loading

OpenScad Surface Solids 1.2

by WilliamAAdams, published

OpenScad Surface Solids 1.2 by WilliamAAdams Jun 17, 2011

Description

I was sitting around the kitchen table wondering how I could model a playground slide, or those water slide tubes.

This thing adds hermite curve/surface support to the OpenScad Surface Solids library.

The basic Hermite interpolation calculation has actually been lurking for a while, but now it's put to good usage. With this, there is now a lerp (linear interpolation), berp (bezier interpolation), and herp (hermite interpolation) in the library.

A Hermite curve is defined by two endpoints, and the tangent vectors to those points. It is somewhat related to a Bezier curve. In fact, I use the same Bernstein basis functions to express it. Some people may find it easier to deal with, some harder, but it's just another tool in the box to help you create surfaces.

In this particular case, I've added a 'sweep_hermite()' module to the renderer. This is really easy to work with. You define one curve to be your 'profile', and you define another curve to be the path along which you'll sweep that profile. The module will take care of creating the appropriate polyhedra to fill in the solid. You can give a thickness, and it will extrude in that direction. This is similar to the linear_extrude.

This also shows a general mechanism for doing sweeps with curves. To make it fully generalized, and to reduce the amount of code needed to support different curves, I'll be further developing the matrix representation of curves. That will essentially be the same as having function pointers for surface creation, if you catch my drift.

I've added some visual debugging support. If you decide to show the control frame, you'll get a nice rendering of the profile and sweeep curves, complete with their tangent vectors.

Using tangent vectors is interesting. You need to be mindful that a vector has a length and direction. The length influences the strength of pull in the particular direction. It's best if you think of them centered at [0,0,0] and point them in the direction you want them to go. You'll have to play around with setting them to get the gist of it.

It occurs to me that this might be a good tool to use while learning about different types of curves and surfaces. Particularly with the visual debugging, and the added bonus that you get to print out a physical thing after you've done all your hard playing around.

I made the license public domain, as this is well trod ground.

Are Splines in the offing?

At any rate...

Recent Comments

view all

I dabble in software for a large company in the pacific northwest. I don't actually do graphics for the company though. Furthest thing from it.

What do you do for a living? Cause you are really good at this...

Soon enough I expect someone to make a commercial for OpenScad like those "I can't believe it's butter" ones from way back.

"I can't believe it's OpenScad!"

I put up a more proper looking playground slide.

Liked By

view all

License

Public Domain
OpenScad Surface Solids 1.2 by WilliamAAdams is licensed under the Public Domain license.

Give a Shout Out

If you print this Thing and display it in public proudly give attribution by printing and displaying this tag. Print Thing Tag

Instructions

1) Download the .scad files
2) Play around with the test_hermite.scad to make pretty pictures
3) Compile and export to .stl
4) Rejoice!

In most cases, it will generate a solid surface which can be turned into a .stl file. The most likely usage here is to generate singular pieces that are stuck together with other pieces. Like my water slide shutes.

Comments

You must be logged in to post a comment.

Linkreincarnate on Jun 19, 2011 said:

What do you do for a living? Cause you are really good at this...

WilliamAAdams on Jun 19, 2011 said:

I dabble in software for a large company in the pacific northwest. I don't actually do graphics for the company though. Furthest thing from it.

WilliamAAdams on Jun 18, 2011 said:

Soon enough I expect someone to make a commercial for OpenScad like those "I can't believe it's butter" ones from way back.

"I can't believe it's OpenScad!"

I put up a more proper looking playground slide.

rbisping on Jun 18, 2011 said:

I beleive the Derp expression origionated with the swedish chef on the muppet show, though Im not absolutly certain of it.

Mike77 on Jun 17, 2011 said:

Before reading the rest of this comment, please understand I hold both you and your work in the highest regard. This is excellent work.

In colloquial north american english there is an expression: "Herp Derp!" often abbreviated to "Derp!" which is often used to mock dialog deemed so stupid as to be nonsensical. Finding a function at this level with that name has inspired enough laughter to improve my day as much as this code is l
ikely to improve my work. Thank you. :-D

WilliamAAdams on Jun 17, 2011 said:

Hah! Herp Derp... Sounds kind of like "Ropa Dope". I'll have to find a curve that begins with 'D' so I can create a 'derp' module!

Top