i have 2 line segments ( with multiple points ) . i want to match the shape of line1(source) to line2(target).
so i calculate the vector between pt1 and pt0 and use a dihedral to rotate the source line to match the target.
it works in a test about the origin.... but when they are out in world space it doesnt quite work.
ps : new to matrices in houdini.
here is a simple test
ps2: what i eventually want to do is match target's shape to source, segment by segment so the illusion of unrolling
matrix math help : aligning 2 vectors using dihedral
1212 3 1-
- carthick
- Member
- 28 posts
- Joined: Aug. 2013
- Offline
-
- toadstorm
- Member
- 406 posts
- Joined: April 2017
- Offline
When you're doing anything involving rotations, you need to keep the pivot in mind. If you're just multiplying points by a 3x3 matrix, the assumption is that you're rotating about the origin. If that's not what you want, what you need to do is subtract some value from P so that the point you want to rotate around is at the origin, then multiply by your matrix, then add that same value you subtracted back to P.
MOPs (Motion Operators for Houdini): http://www.motionoperators.com [www.motionoperators.com]
-
- carthick
- Member
- 28 posts
- Joined: Aug. 2013
- Offline
-
- toadstorm
- Member
- 406 posts
- Joined: April 2017
- Offline
You could go about it that way if you wanted, but really it's probably easier to just subtract some value V from P so that your pivot lies at the origin, then multiply P by your 3x3, then add V back to P and you're done. The exact value for V depends on what you want to rotate around.
MOPs (Motion Operators for Houdini): http://www.motionoperators.com [www.motionoperators.com]
-
- Quick Links

