Jump to content
AnthonyVFX

Create a center line

Recommended Posts

Hi all,

I’m trying to create a center line (not just a center point) based on other lines in VEX. Attached is a photo of the code I used to create the lines. Will anyone share how to derive a center line from existing lines in VEX?

648FC379-A643-4176-8228-E0B5A8310836.jpeg

Share this post


Link to post
Share on other sites

It's impossible to help you without a hip file. Please upload one so we can see the broader context of your setup.

"Center line" is ambiguous. Please provide demonstration geometry and a rough-in geo of what you expect to see.

Share this post


Link to post
Share on other sites

isn't it just the average of the targets, create another line from the shooter to the average just found...that's your line ?

Share this post


Link to post
Share on other sites

here....well there's actually NO vex as you asked for...

it's already done...just needs abit of 'extra' logic....the count of shooter is now + 1

vu_Web-line-example.hipnc

Share this post


Link to post
Share on other sites

Thanks so much for your help! I have a problem though. The red line in the files you sent me go to the origin, and not to the center of the target points. Any idea why the difference in opening the files in your version of Houdini versus mine (Apprentice)?

3DCAE440-EA04-4DB6-8A10-40536186BABC.jpeg

Share this post


Link to post
Share on other sites

Nevermind! The problem was, simply enough, that two nodes were not appended. 

Thanks again!

Share this post


Link to post
Share on other sites

...actually, I’ve notice that the center line created was only among one cluster of target points/lines, not all 7 of the clustered target point/lines. How do get that center line?

Share this post


Link to post
Share on other sites

well I thought you wanted an average line among the 30 points. Are you saying you want an average line per cluster? ie you want 7 red lines ?

Share this post


Link to post
Share on other sites

No, that's right. I wanted the average of the 30 points. But the red, center line appears to only be in one of the 7 clusters. It's not that way with your file?

Anyway, I seemed to have fixed it by swapping out the add node with the extract centroid node.

I have just moved on to figuring out how to pull those 30 lines toward the red, center line with a ramp parameter (so that I can play with the web shape)...

I seem to be pulling the lines to the origin and not the red, center line, so something is off (at least I'm not getting an error message!). Any insights on that are welcome! (smile)

 

Edited by AnthonyVFX

Share this post


Link to post
Share on other sites

nah...I'm sure that is the average of all points not just one cluster

here's a simpler setup to lookat, same result

the cluster treats all points as ONE cluster, get the avg of that.

then just create ONE line using point 0 in the wrangle.

(just by eyes, I reckon the centre is the avg of all points and not a particular group of points)

 

centre.jpg

vu_Web-line-example3.hipnc

Edited by Noobini
  • Thanks 1

Share this post


Link to post
Share on other sites

Oh, cool! Thanks for showing me another way to do this setup. ...Not sure what happen with the other file. I've attached what I see.

Anyway, I thank you just the same for your time and efforts!

red line off center.jpg

Share this post


Link to post
Share on other sites

I'm on 18.0.348

sometimes opening H18 file in H17...it goes wonky...just beware.

Share this post


Link to post
Share on other sites

Well, regardless, I appreciate your time and efforts. You really got this newbie unstuck!

Share this post


Link to post
Share on other sites

Hi there, Noobini, would you be willing and able to help with pulling those main lines to the red center line? My VEX is off, not with an error, but it's pulling those main lines to the origin.

vu_Web-line-example4.hipnc

lines to origin.jpg

Share this post


Link to post
Share on other sites

I have absolutely no idea what you're trying to do....but here's my best guess:

- attribcreate lineID should be an integer not float. Easiest is to simply use the shooter ID ie. the @ptnum. You can see I set this up right after where the color of the line is set. For the red line, the last shooter ID should be the count of your scatter points. It probably doesn't matter what this last ID is really.

- the resample should have a constant number of segments across ALL lines...for easy point matching up (morphing) later. Also turn on curveu, this will save you doing manual work later on your own. Hey it's FREE...use it.

- the point SOP in the for loop is where the magic happens. Amt is how much pull towards the centre line, play with the ramp to tweak your spiderweb shape. Go nuts.

 

webshooter.jpg

vu_Web-line-example5.hipnc

(in the end you probably don't need line ID for anything at all...unless there's more effects later on)

Edited by Noobini
  • Thanks 1

Share this post


Link to post
Share on other sites

Wow! That is what I’m going for. Thanks so much. I will check this out. 

...I will say that I think I need the line ID next for adding webs between the lines. ...But I’ll check out what you did before committing to that. (Smile)

Edited by AnthonyVFX

Share this post


Link to post
Share on other sites

did my best to sort out your logic...if you open geo spreasheet adjust Overalldensity, you'll see nearPts arrays being filled up accordingly...

that's as far as I got...dunno what what your partVal is...is that line ID ?

just beware that when looking for nearpoints, it wants to know up to how many points do you want to find ie. some discrete number like 1, 5, 10....your initial result of mult some ramp number with some other fractional number is gonna give you some fractional number less than 1...ie you're getting nuthin'. Hence you see I've mult that by 20 and made that into an int.

vu_Web-line-example8.hipnc

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×