Simple Curves

file Banner.png
Click here to get to the Guided Houdini Files.

 

In most situations we will start with already existing geometry and transform it into new geometries. Such is the usual method to create curves from lines that we will now learn.

This approach is similar to the standard way of dealing with curves and surfaces in differential geometry: One starts with a parameter domain $M$ which could be a subset of $\mathbb{R}^n$ or just an abstract $n$-dimensional manifold. For concreteness, just imagine that $n$ is either one (for the study of curves) or two (for surfaces). The geometric objects of interest are then certain smooth maps $f:M \to \mathbb{R}^3$. Such an $f$ is then called a parametrized curve (in case $n=1$) or a parametrized surface (if $n=2$).

If $M$ is a compact connected one-dimensional manifold with non-empty boundary we can as well assume that $M$ is a closed interval $[a,b]$ on the real line:

Open Curves

In Houdini a discrete version of the interval $[a,b]$ can conveniently supplied by a Grid node where the Rows has been set to one. The Columns parameter specifies the number of equally spaced sample points on interval. Instead of specifying $a,b$ directly we have to provide $b-a$ as the first component of the Size parameter and $(a+b)/2$ as the first component of the Center parameter. Afterwards we use a node of type Point Wrangle in order to map the $x$-coordinate to the desired space curve.

curve2
Let’s try to map an interval to the curve.

The curve in the last picture results from the VEX code below. alpha, omega and lambda are three float parameters of that Point Wrangle node.

curve-discrete
We only map to points to points but visualize them with lines in between.

Guided Example: Open Curve

Lets see in detail how we archived this. First create a grid node (we named it domain_grid) and adjust its size to 1,1 and the number of rows to 1 and the number of columns to however many points you want.

grid node.PNG
A pretty grid node inside the geometry node.
grid node parm.PNG
The setting that you should have. Only one row makes the grid become a line.

Now we have a curve that is just on the x-axis with values from -1 to 1, meaning that @P.x is the carrier of the running parameter and the only thing we care about. We can transform these values from the [-1,1] to the [0,1] interval using a point wrangler with the following code.

scale x.PNG
Add a point wrangler.

scale code.PNG
Make the point wrangler move the curve to [0,1].

Next we will add another point wrangler to take the @P.x values and use them in our function to map them.

3 nodes.PNG
Add another point wrangler.

curve function.PNG
And place in code to map onto a curve.

57.gif
The resulting curve. Rotated using the trick from the animation tutorial.

Of course we advise to bring in the style nodes from previous tutorials.

style.PNG
Spheres and tubes can make the curve prettier for inspection.
Optional:

You can also add the @Time to @P.x in order to move along the parameter axis. We do this in the scale_x node.

59.gif
Adding @Time to the running parameter.

58.gif
@P.x is changing values inside the scale_x node.

Closed Curves

If $M$ is a compact connected one-dimensional manifold without boundary then we can as well assume that $M$ is the unit circle $S^1\subset \mathbb{R}^2$:

closed-parametrized-curve-smooth
Closed circle mapped to closed curve.

In Houdini a discrete version of the unit circle $S^1$ can conveniently be supplied by a Circle node where the Primitive Type has been set to Polygon. The Divisions parameter specifies the number of equally spaced sample points on the circle. Afterwards we use a node of type Point Wrangle in order to map the$(x,y)$-coordinates on the circle to the desired space curve. The curve in the last picture results from the VEX code below. k is an integer parameter and r a float parameter of that Point Wrangle node.

We have used here an include file “Complex.h” which implements some complex arithmetic function definitions. We discuss this in detail in the tutorial on Custom Code.

closed-parametrized-curve-discrete
Again, we only map points to points.

Note that the sample points on the space curve roughly look equally spaced. The reason is that in this particular example the corresponding smooth curve is parametrized by arclength for all values of the parameters $k,r$. This means that if $p$ runs through the unit circle with unit speed then also $\gamma(s)$ travels with unit speed.

Guided Example: Closed Curve

Open up your circle node and set the parameters as shown in the gif. Make sure that the Primitive Type is set to Polygon.

60.gif
Placing a circle node and refining it as a polygon.

Continue by implementing two point wranglers with the VEX code below. The Time_Motion node is optional and implemented to show the closed nature of the curve.

circle functions.PNG
The pipeline of a circle with to point wranglers.

Here we used atan2(s,c) in order to get the angle of the point in the circle.

Don’t be surprised if your resulting object is still not a curve. You will still only have a deformed circle. In order to make the function pretty again you need to insert the wire frame and spheres at least. Tip: always try to keep the nodes as organized as possible.

62.gif
Added style nodes. Keep them nice looking.
ugly circle.PNG
Not Nice…
61.gif
Nice… Press play in Houdini to see the time motion in action

 

 

Optional note: By inserting a remesh node you can make use of the whole geometry. This might become handy if you need a triangulation of a disc.

63.gif
Getting the triangulation of the circle area and not just the curve.
Print Friendly, PDF & Email