Jump to content
BeachBoy

Cross Product not returning perpendicular axis

Recommended Posts

Hey all,

I was working on a tool to instance branches along a curve when I ran into a slight issue with cross products. I'm trying to find the perpendicular axis between the tangent along a curve and a side vector so I could pitch a branch up or downwards but the vector returned by the cross function seems to pointing a weird way.

If anyone would be so kind as to take a look at this, I'd greatly appreciate it!

 

Thank you.

CrossProd_weirdness.hiplc

Share this post


Link to post
Share on other sites

Hi Irvin,
in the attached picture ... by typing only @tan you cast the vector into the float. You read only @tan[0].  And then you store that float into the vector tan.

If you want to read custom vector attribute, you have to type v@tan

 

 

image.thumb.png.6eb771ab2239473813a2535797aa8f92.png

  • Like 1

Share this post


Link to post
Share on other sites
Quote

vector normal = @N;
vector tan = @tan;

Instead of using @tan, you should use v@tan. Houdini only recognizes default attributes correctly. So if you use @tan, it is interpreted as one single float for all three axis. Ah.... juse a few minutes too late :)

Edited by haggi
  • Like 2

Share this post


Link to post
Share on other sites

Hey Ikoon & Haggi,

Thanks, this does the trick. This is very helpful to keep in mind for the future!!

 

  • Like 1

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

×