Create Bezier/NURBS curve from points?

   8565   12   3
User Avatar
Member
271 posts
Joined: March 2012
Offline
I cannot find a way to convert a series of points to a Bezier/NURBS curve that uses breakpoints (I need the curve to go through the original points).

If I use a convert node, the curve does not go through the points.
If I use a curve node, there's no way to procedurally tell it to use the input points (you have to manually type “p0 p1 p2 p3”… in the coordinates).
I've seen some other posts where people talk about using an add SOP, but that doesn't make a curve, just a poly.

I feel like I'm missing something that should be simple.
User Avatar
Member
1192 posts
Joined: July 2005
Offline
PolySpline with “Cardinal” spline type after the Add SOP will give you a polygon in the shape you need.
Be sue to increase First/Last CV count as well.
Dragos Stefan
producer + director @ www.dsg.ro
www.dragosstefan.ro
User Avatar
Member
1569 posts
Joined: Sept. 2015
Offline
Sorry to “Hi-Jack” this thread, but this solution seems to be what I was looking for in regards to similar question I have asked elsewhere a couple times.

So I put down an add sop and created 3 points and defined them each with their respective locations. Turned on point numbering, so indeed I can see them.

Then I put down a polyspline with the add sop going into it.

Set to cardinal and played around with adjusting First/Last CV count….and other settings too because no matter what I do there doesn't seem to be any line/curve that gets formed. The points just remain points.

I guess I need to lay down another node after that polyspline?
User Avatar
Member
1192 posts
Joined: July 2005
Offline
I guess I need to lay down another node after that polyspline?
You only need to spend 3 min with the Add SOP help page, and load the example provided there.

Which actually offers one more solution to the OP's problem, using the Fit SOP.
Dragos Stefan
producer + director @ www.dsg.ro
www.dragosstefan.ro
User Avatar
Member
1569 posts
Joined: Sept. 2015
Offline
Ok…still very much a beginer…spoke too soon.

So in the point sop, selecting by group tab with all points set gives me my curve I want.

so thanks so much for the original poster in asking the question and digitalysanes answer
User Avatar
Staff
3384 posts
Joined: July 2005
Offline
on the Add SOP, Polygons tab, By Group
Michael Goldfarb | www.odforce.net
Senior Technical Director
SideFX
www.sidefx.com
User Avatar
Member
1569 posts
Joined: Sept. 2015
Offline
Yes Arctor….actually I meant “Add” sop not point sop, as I am creating the location of the points that I desire with the Add sop; led me to think of it in terms of a point sop.

So this combination of - Add Sop > Fit Node > Polyspline

Is “exactly” what I was looking for in terms of implementation.

What I wanted is the ability for me to be able to establish bezier curves with “breakpoints” that I could move dynamically with scripting and the separate option of being able alter the shape of the curve while the “breakpoints” remain on the curve and their position not become altered as a result of the curve reshaping.

This can be accomplished with the cv tension “attribute” of the polyspline.

The net result is that it imitates ( gets close, and good enough for now ) the likeness in capacity to create my paths as if I was using Illustrators pen and anchor tool. Like I am able to create single or groups of bezier curves/paths with controlling handles.

Until this thread topic came up I was thinking that I was going to have to teach myself the math behind bezier curves and write a Python script to implement it; Something that would take me a fair bit of time to say the least.

So thanks everyone for contributing to this topic and thread. Has saved me much work.
User Avatar
Member
1192 posts
Joined: July 2005
Offline
It should be either Add -> PolySpline or Add -> Fit, but you don't need both.
Just be sure you use the Polygon/Group on the Add.
Good luck!
Dragos Stefan
producer + director @ www.dsg.ro
www.dragosstefan.ro
User Avatar
Staff
3384 posts
Joined: July 2005
Offline
also check out the Path Tool - it makes a bezier curve based on PathCV nulls
you might find it interesting.
Michael Goldfarb | www.odforce.net
Senior Technical Director
SideFX
www.sidefx.com
User Avatar
Member
1569 posts
Joined: Sept. 2015
Offline
Thanks guys
User Avatar
Member
1569 posts
Joined: Sept. 2015
Offline
I want to say thanks again arctor.

The reason being is that tried putting down a path tool, but I did so while in network window, so I didn't realize how or where the PathCV “nodes” can come into play.

So I was reading in the help files to how I could get more use of the path tool compared to what I was using and discovered they mention about creating the path tool while in scene view.

so by placing down points those pathCVs get created automatically and also looking at where they fit within the path node noticed how I could add PathCVs after the path is created too.

So this Path tool is really much more than I expected was possible and very easy to use.

Thanks again
User Avatar
Member
8 posts
Joined: Oct. 2015
Offline
I think there isn't any simple way to make Bezier Curve go through some certain points PRECISELY. Maybe you can run a nonlinear fit with the point locations using the parametric equation, eg. for a Bezier Curve with four control points, gives:

B(t) = P0(1-t)^3+3P1t(1-t)^2+3P2t^2(1-t)+P3t^3

but it seems crazy to do curve fit in Houdini.

Maybe you can just use ADD node to connect the points and use resample to make the curve smooth…
User Avatar
Member
1569 posts
Joined: Sept. 2015
Offline
Hi solarain…thanks for that input.

Yeah I tried something to the effect of using an ADD node connecting points and a resample, the only problem with that was when I moved one point it ‘broke’ the curve between that point and it's adjacent points; Meaning they became straight lines.

But I guess if I used the parametric equation you provided I could re-establish a curve feature with the moved point.

Although the Path and PathCV nodes does provide me with the capacity to run the curves through “points PRECISELY” and this method does allow me to implement some ideas I was hoping to do, there are still some limitations for another idea that the Path/PathCV nodes doesn't let me do.

But your suggestion may help in that regard so I will have to revisit that equation and try working with it at some point.

Thanks
  • Quick Links