Jump to content

measure curvature


freaq

Recommended Posts

Hello odforce,

i'm quite new to houdini and i'm encountering a fairly annoying and specific issue,

I need to compare the curvature of 8 curves, curves, and seperate them out into the 4 more straight, and the 4 more "curvy" curves.

I am trying to do this by using a Measure SOP, using an attributepromote to sum the numbers together. to get a value.

after that I would like to proceed to average all the numbers and delete the curves with a highe/lower value than average to get my selection.

however this approach seems to be very unstable, curvature is sometimes not detected and sometimes is.

I have tried Nurbs, Polygon, and nothing seems to help.

also testing perimiter the same way is stable so I can't seem to find what i'm doing wrong.

any thoughts would be greatly appreciated.

Freek Hoekstra

Link to comment
Share on other sites

Well, there is a way I know of to do it in CHOPS, though I am sure it is a very convoluted method. If you use steps 3-6 in my Drama Cam tutorial from my site and the first node on the right branch (targeting the null) of the network you can get the information into your CHOP network. Then you can use a slope node to calculate the derivatives of each null's path, which is by definition the curvature of your line. With some tricks for comparing them and some switches, you can get the right outputs.

I am wanting to explain some of the math behind how this all works, but I am having trouble finding the words to not sound like a condescending ass, and I really don't want to do that. If you have any questions, I would be more than happy to answer them.

Link to comment
Share on other sites

What exactly do you mean by curvature? There is quite a few ways to look at curvature. The most intuitive way is what Adam described but how do you get a curvature for the whole curve then? Sum it up? What if the curve is very long but not curvy enough? You normalize its length?

I played around with some ideas but it seems that the measure sop doesn't quite work for this (I get nonsense values) and the curvature expression neither (I don't know where I go wrong with that one but it should work...)

Another idea to get at some global notion of curvyness may be to take the integral of these curves and then just see which one covers more "area". Then again, you should have equal length curves to make sense of it. I suppose you could normalize them but I don't know if vex can accept vectors with more than 3 components, or if there is another way to do it.

Edited by Macha
Link to comment
Share on other sites

Actually, I'm puzzled by that curvature expression. Perhaps somebody can have a look at the red node and tell me whats wrong... It looks like it should be so straightforward and at least show something other than 0... (maybe it doesn't work with curves)

Edit: Uups, texture node should be earlier. Doesn't change anything though :)

curv.hip

Edited by Macha
Link to comment
Share on other sites

Here is a scene that sorts curves by "curvyness".

It is, and I am so sorry about that, very messy and without notes. But perhaps it is helpful to somebody.

It includes a Python sop. I hope it's wrapped in the file.

Green are original curves. Red are the same curves sorted.

curvbsort.hip

post-4013-130698334548_thumb.jpg

Link to comment
Share on other sites

Here is a scene that sorts curves by "curvyness".

It is, and I am so sorry about that, very messy and without notes. But perhaps it is helpful to somebody.

It includes a Python sop. I hope it's wrapped in the file.

Green are original curves. Red are the same curves sorted.

thank you for your reply, that is pretty much exactly what I need,

but I am afraid I am missing the mycurvesort node.,if you could share it that would be great!.

also the link in the (first reply) seems to be broken.

still many many thanks for your replies!

i will try the chops method as soon as I have time.

and if you could upload the mycurvesort asset that would be absolutely fantastic,

thanks for your help guys!

Link to comment
Share on other sites

and if you could upload the mycurvesort asset that would be absolutely fantastic,

Hmph. That always happens to my Python sops and I always forget how to embed them into the hip file. Something about right-click and...

I won't have access to that file until Monday but in the meantime I can describe what it does:

-make a (ordered) list that contains the calculated curvature per curve, that is per-primitive

-sort that list

-use the index of the elements of that list as the order by curvature of the curves

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...