freaq Posted June 1, 2011 Share Posted June 1, 2011 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 Quote Link to comment Share on other sites More sharing options...
Macha Posted June 1, 2011 Share Posted June 1, 2011 (edited) See if this helps Freek: http://www.sidefx.com/docs/houdini11.0/expressions/curvature Edited June 1, 2011 by Macha Quote Link to comment Share on other sites More sharing options...
Adam Ferestad Posted June 1, 2011 Share Posted June 1, 2011 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. Quote Link to comment Share on other sites More sharing options...
Macha Posted June 2, 2011 Share Posted June 2, 2011 (edited) 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 June 2, 2011 by Macha Quote Link to comment Share on other sites More sharing options...
Macha Posted June 2, 2011 Share Posted June 2, 2011 (edited) 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 June 2, 2011 by Macha Quote Link to comment Share on other sites More sharing options...
Macha Posted June 2, 2011 Share Posted June 2, 2011 (edited) Here's a workaround that seems to give correct curvature. The more curvy, the redder. I suppose you average-promote the curv attribute and can then sort. curvb.hip Edited June 2, 2011 by Macha Quote Link to comment Share on other sites More sharing options...
Macha Posted June 2, 2011 Share Posted June 2, 2011 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 Quote Link to comment Share on other sites More sharing options...
Adam Ferestad Posted June 2, 2011 Share Posted June 2, 2011 I am going to have to look at that stuff Marc. I am really interested in seeing how you got the data around to calculate all of that. Looks really cool. Quote Link to comment Share on other sites More sharing options...
freaq Posted June 3, 2011 Author Share Posted June 3, 2011 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! Quote Link to comment Share on other sites More sharing options...
Macha Posted June 4, 2011 Share Posted June 4, 2011 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.