Jump to content

# transforming a Vex-built PolyLine

## Recommended Posts

Hello to all!

I am currently writing a wrangle-thing in which I'm hoping to generate a random "hair" on every point and make it face the normal of said point.

The way I planned it is as follows:

1. create the hair w/ random params on 0,0,0

2. rotate the hair to Normal of the point that it's "generated on" w/ rotate(matrix,angle,vertex) function

3. Move the hair to @P

I'm not a hero with vector math, otherwise I'd generate the whole hair thing along a normal.

I wonder if I somehow can construct a identity matrix, like one would do with the ident() function, and use that to transform the prim.

Is there a way to simply rotate a primitive using something simpler than extreme vector math?

sgamhar.hip

#### Share this post

##### Share on other sites

There is a preset to Grow Hairs on the point wrangle, might give you some tips:

#### Share this post

##### Share on other sites

Just create a point at the same position and displace by normal @P += @N (or multiply) and connect them

#### Share this post

##### Share on other sites
On 6/6/2018 at 5:52 PM, Yon said:

Just create a point at the same position and displace by normal @P += @N (or multiply) and connect them

Could you explain a little bit more?

I don't quite get it...

Does the displace by normal take care of origin-based rotation? I guess it'll have to be multiplication then.
I'll try it out, at least what I can make of your advice!

#### Share this post

##### Share on other sites

Ah, I finally get what you've been trying to tell me. That part would've gone in the actual "hair grower" part of the algorithm, but the thing is that I can't use that because I have a twirl thing based
on some simple goniometric mathematics.

I'll be doing more experiments and trying things out.

I'll probably end up making every hair a new primitive, and using a primitve wrangle after that to wrangle them in the correct spot.

#### Share this post

##### Share on other sites

Hello to all. I solved the math problem, ended up using the qrotate function together with quaternion in vectoraxis mode.

I botched it a bit using the normal as the axis, multiplying it slightly, and then correcting the angle based on wether the dot product of the Normal and the up vector was positive or negative.

I'm stoked this even works. I love houdini for its "multiple ways to rome" capabilities.

I still don't understand nothing about quaternions but this at least gives me a vague ideo on how to use them.

Thanks again for the help. I've included what I have now, to share with everybody.

sgamhar_2.hip

## 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

×
• Donations

• Leaderboard