Parametric curve from formule?

   5323   15   2
User Avatar
Member
49 posts
Joined: Feb. 2007
Offline
I would like create a curve (nurbs or bezier) in parametric way. I know its formule for X,Y,Z vectors.

I trying first create a curve from circle primitive, then adding Point VOP and move points with VEX nodes, but I would like to know if is there any quick way to input formule?
User Avatar
Member
806 posts
Joined: Oct. 2016
Offline
Hi,

you can add an empty geometry and use a wrangle node on the detail (“run once”) to add the points using
addpoint
.

Marc
---
Out of here. Being called a dick after having supported Houdini users for years is over my paygrade.
I will work for money, but NOT for "you have to provide people with free products" Indie-artists.
Good bye.
https://www.marc-albrecht.de [www.marc-albrecht.de]
User Avatar
Member
49 posts
Joined: Feb. 2007
Offline
Thanks malbrecht

I find something like Curve Equation in Catia ( http://maruf.ca/files/catiahelp/sdgug_C2/sdgugat0105.htm [maruf.ca] ) where typing a expression from Law definition (Step 10) software computes and drawing the curve. I guess in VEXpression this is possible, but there is a function to draw curve from vectors?
Edited by Unaided - Dec. 28, 2016 01:44:00
User Avatar
Member
806 posts
Joined: Oct. 2016
Offline
Hi,

maybe this post can help you [sidefx.com]? “Drawing a curve” isn't exactly trivial - what I probably would do is a create a line/polyline and, if needed, add more points until the desired resolution is reached. If I wanted to interpolate, I'd use a spline function (my own or some preset, I am not familiar enough with Houdini yet, I am a Fabric guy).

A bezier - for me - isn't exact enough, but I guess you should be able to define that from code as well.

Marc
---
Out of here. Being called a dick after having supported Houdini users for years is over my paygrade.
I will work for money, but NOT for "you have to provide people with free products" Indie-artists.
Good bye.
https://www.marc-albrecht.de [www.marc-albrecht.de]
User Avatar
Member
2042 posts
Joined: Sept. 2015
Offline
Actually it is trivial…what isn't trivial is figuring it out from just reading the docs…the vex spline function will do it combined with vex polylines. There are 5 other spline function varieties under the Math section of Vex Functions in docs.

If I can find the file where I did this I will post..but otherwise as I learned again when I was trying the vex ‘sample_circle_arc’ function….although I couldn't understand from the docs what it could be used for…just by some trial and ‘error’ plugging in different values for the arguments you start to get an idea of what it can be used for.
User Avatar
Member
2042 posts
Joined: Sept. 2015
Offline
Ok..couldn't find it so I put together a small example.

The function is in an external file I'm attaching as well. Just use the #include statment in vex to be able to access the function.

The function returns the number of ‘points’ you have which changes by the value you set with the Resolution paramter.( of which I should have made an integer instead of a float but it still works).

This is just an example of using two points to define the bezier, although you could define more points with more arguments.( or something like that, it's been a while since I've read the docs on those spline functions.)

I've made some parameters so you can adjust the arguments to the function and see how it affects the bezier.
Edited by BabaJ - Dec. 27, 2016 22:33:13

Attachments:
Vex Polyspline.hiplc (67.4 KB)
Polyspline_Example.h (780 bytes)

User Avatar
Member
49 posts
Joined: Feb. 2007
Offline
Thank you for your reply guys.

I think that I shouldn't need a low level definition as using VEX.

I found this doc, that is old reference, but it seems I need.
http://www.sidefx.com/docs/houdini11.0/ref/expression_cookbook [sidefx.com]



PS. Marc, are you a ex-SI developer?
User Avatar
Member
806 posts
Joined: Oct. 2016
Offline
> PS. Marc, are you a ex-SI developer?

no, unfortunately I am just a regular dude who has a different definition of “trivial” than BabaJ :-D

Marc
---
Out of here. Being called a dick after having supported Houdini users for years is over my paygrade.
I will work for money, but NOT for "you have to provide people with free products" Indie-artists.
Good bye.
https://www.marc-albrecht.de [www.marc-albrecht.de]
User Avatar
Member
49 posts
Joined: Feb. 2007
Offline
malbrecht
> PS. Marc, are you a ex-SI developer?

no, unfortunately I am just a regular dude who has a different definition of “trivial” than BabaJ :-D

Marc
User Avatar
Member
49 posts
Joined: Feb. 2007
Offline
I have tried with circle equation, but I don't know why start and end points aren't in the same position.
Somebody can help me to translate correctly curve equation to VEX?

Attachments:
Captura de pantalla 2016-12-29 a las 20.01.13 (2).png (289.9 KB)

User Avatar
Member
806 posts
Joined: Oct. 2016
Offline
Moin,

sin(6) is not what you _want_, but what you are _using_

Try this:

@P.y=0.0;
@P.x=sin(@ptnum*2*3.14159265/(ch('../line1/points')-1));
@P.z=cos(@ptnum*2*3.14159265/(ch('../line1/points')-1));

Comment: The “2*pi” is for the radiant value you need to use with trigonometry in VEX, the “ch(…” is to get the number of points from your line-object, so that you can change the resolution.

I hope this helps!


Marc
---
Out of here. Being called a dick after having supported Houdini users for years is over my paygrade.
I will work for money, but NOT for "you have to provide people with free products" Indie-artists.
Good bye.
https://www.marc-albrecht.de [www.marc-albrecht.de]
User Avatar
Member
2042 posts
Joined: Sept. 2015
Offline
Maybe you might want to use the vex ‘sample_circle_arc’ function.

Attachments:
Vex Circle_Arcs.hiplc (96.8 KB)

User Avatar
Member
49 posts
Joined: Feb. 2007
Offline
Thanks!

It's clarifyng for me. So why substract 1 value from radiant value?

I'm triying to build a small digital asset, that include a bit more complex curve equation than circle. However due I'm not having successful in that, I have try before with a more elementary thing like a circle equation.

At this point, I have reached to generate the curve shape by increasing number of points, but I think is not good solution because points aren't properly sorted.
I going to try dividing by line/points like you example for circle, Marc.
User Avatar
Member
806 posts
Joined: Oct. 2016
Offline
Moin,

Unaided
It's clarifyng for me. So why substract 1 value from radiant value?

I am not subtracting from the radiant. But your point index only runs from 0 to point-count minus 1, so if you don't want a gap, you have to also reduce the max value by 1. Else you only ever get to the last but one point.
Take a piece of paper and do it manually once. I always find that helpful.

Marc
---
Out of here. Being called a dick after having supported Houdini users for years is over my paygrade.
I will work for money, but NOT for "you have to provide people with free products" Indie-artists.
Good bye.
https://www.marc-albrecht.de [www.marc-albrecht.de]
User Avatar
Member
2042 posts
Joined: Sept. 2015
Offline
“..I'm triying to build a small digital asset, that include a bit more complex curve equation than circle. However due I'm not having successful in that, I have try before with a more elementary thing like a circle equation..”

If you spend a little time with the vex spline example I showed earlier…you will find you can make any type of curve with complete control over the points that define the function which makes the curve.

As Marc said earlier, it's not trivial…and even though it might look ‘complex’…it's actually very simple. What I mean by that is say for example you go do a google search on Bezier functions, and read a bit about how they are formed, you'll start to see how the ‘arguments’ of the vex spline function correlate to the mathematical functions used to make the curves; and in a sense you can't get any better than that unless get something that has ‘wrapped’ it, the path and pathcv nodes are like wrappers of that basic vex/math bezier function; your working more with the nodes rather than vex code.
User Avatar
Member
49 posts
Joined: Feb. 2007
Offline
Thank you guys for your replies!

I've been successfully done my desired curve equation inside Houdini with VEX code in Wrangler SOP. Maybe too I'll try build it in VEX builder to have the same equation as graphic tree.

Next issue I have found it seems doing a twist or rotation normals in points generation. There is no problem excepts for start-ends curve, and the next operation that I want to do with this curve.

I think I will to open new topic to show this question, because I think this is other situation and I'm not found the way to solve it.
  • Quick Links