[Sidefx-houdini-list] converting point/particle rotations to Euler rotations

Jeff Wagner jeff at sidefx.com
Thu Mar 9 08:22:01 EST 2006


matrix rotate (float angle, string axis)
matrix rotaxis (float angle, vector axis)
matrix mlookat (vector from, vector to)
matrix mlookatup (vector from, vector to, vector up)

with vector() and vector3() expressions to fill in the various vectors

then use

float explodematrix (matrix mat, string trs, string xyz, string component)

to get at the various bits that you need. The mlookatup() expression is 
especially handy as yuo can supply an up vector that tends to avoid 
flipping at the poles. You can't easily "see" vectors so many times you 
get in to gimbal lock without even knowing it. Use up vectors if you use 
euler rotations.

Makes for meaty expressions so best use the expression editor alt-e to 
add carriage returns or use the expression function syntax in {} to 
write slightly more robust expressions (in what I call pseudo-c code).


You can also use VOPs or VEX to do the matrix manipulations. Just faster 
and usually cleaner. If I were doing this all the time, I would do it in 
VEX. HDK is another approach but not applicable to a great many users.


-jeff

Lucio Flores wrote:

>--- Andrew D Lyons <tstexture at gmail.com> wrote:
>
>  
>
>>Hi,
>>
>>I'm guessing others have come across this problem so I thought I'd
>>bounce it here for ideas.
>>
>>In Houdini we tend to rotate vectors such as "N" and "up" a lot to
>>create point/particle rotations.
>>
>>Say for instance you have some external software that requires all
>>point/particle rotations to be described as Euler rotations.
>>    
>>
>
>Ha ha!!!! WHY?!?!?!?!  I know, I know, antiquated pipeline.... The '80's style
>Euler tumbling' option in the 3D viewport preferences dialog still makes me
>laugh....
>
>  
>
>>What's the best, sure-fire, works-every-time solution to this
>>conversion? (Something that can look at a point that has been aligned
>>by noise fields, follow pops, rotation pops and transform sops and
>>give a clean Euler representation?)
>>    
>>
>
>Don't know if you have an HDK person there, but they have a solution for this
>in UT_Matrix4 called UT_Matrix4::instance(). It's takes a position and velocity
>vector, and takes an optional upVector, optional rot quaternion, and another
>optional orient quaternion. You would specify each optional particle attribute
>if they exist, and it returns a translation matrix. Then you could use
>UT_Matrix4::explode() to extract euler rotations in any rotation order. 
>
>  
>
>>NB: For motion blur reasons it needs to calculate continuous
>>rotations. ie - 359 + 2 = 361 -not- 359 + 2 = 1
>>
>>    
>>
>
>For this, you can write a script to detect any -180 to 180 flip, and add 360 to
>the solution to keep this from happening. 
>
>  
>
>>Cheers
>>
>>P.S. Have seen Particle CHOP. Ideally we want to pull in points from
>>SOPS - not just POPs. Also perhaps specify rotation order like Object
>>CHOP.
>>
>>    
>>
>
>If you do go the hdk route, then make a vex operator out of it, then you can
>call it an any context. 
>
>
>-------------------------------------------
>
>Manson: My philosophy is:  Don't think.  I don't believe in the mind that you think with and scheme with.  I don't believe in words.
>
>Reporter: If you don't believe in words, why do you use so many of them?
>
>Manson: Words are symbols.  All I'm doing is jumbling the symbols in your brain.  Everything is symbolic.  Symbols are just connections in your brain.  Even your body is a symbol.
>
>__________________________________________________
>Do You Yahoo!?
>Tired of spam?  Yahoo! Mail has the best spam protection around 
>http://mail.yahoo.com 
>_______________________________________________
>Sidefx-houdini-list mailing list
>Sidefx-houdini-list at sidefx.com
>https://lists.sidefx.com:443/mailman/listinfo/sidefx-houdini-list
>  
>


-- 
Jeff Wagner, jeff at sidefx.com, Senior Technology Consultant
Side Effects Software, www.sidefx.com, Toronto, Ontario, M5V 3E7
tel: (416) 504-9876, fax: (416) 504-6648




More information about the Sidefx-houdini-list mailing list