Twist complex objects

   1844   6   1
User Avatar
Member
39 posts
Joined: Dec. 2010
Offline
Hi Guys. I need to get curved object to be twisted. “Bend” node won't work here as I will have complex shape later on and twisting should consider the shape of the object. I'm using a curve to drive the object shape so I have attributes such as pivot points and axis for each point. The only thing I need to do is to rotate those points around axis on specific angle. Sounds quite straightforward but I can't make it work. I tried lots of approaches but nothing worked well. On the image below. On the screen left I have the object that I need to be twisted. Middle one is the result that I got using matrices. It looks promising but points got scaled for some reasons. And the right one is the Quaternion rotation that does something but looks like axis is wrong even though it should be correct.

Does anyone know how to do it properly ?



Thank you

Attachments:
rotation.jpg (110.5 KB)

User Avatar
Member
678 posts
Joined: Feb. 2017
Offline
Hey maxpayne,

have you considered to build the object straight? then use the labs' path deform to deform it along your curve. it has a twist already integrated.

Cheers
CYTE
User Avatar
Member
39 posts
Joined: Dec. 2010
Offline
It is originally straight and I'm using point deform to drive the shape but then I'm adding details on it and I would like those details to be twisted as well.

Attachments:
object_example.jpg (48.0 KB)

User Avatar
Member
472 posts
Joined: July 2005
Offline
Hi,

if you have curve (along the object), you can use “orientation along curve” to get the tangent of the curve, which defines a local

axis (“polyframe” is also ok, since you only need the tangent). The curve should have enough subdivisions.

If you don't have curve, there are probably ways to construct curves from the geometry, but this is not trivial.

If you have a curve (with a tangent), you can capture the geometry using xyzdist() to get the local coordinates of the closest point

on the curve. With these coordinates you get the position/tangent to create a rotation for each point.
Edited by Aizatulin - April 1, 2020 12:37:43

Attachments:
twist_around_curve.hipnc (129.4 KB)

User Avatar
Member
39 posts
Joined: Dec. 2010
Offline
Hi Aizatulin. Thank you for your reply. That's exactly what I need. I supposed to use tangents for rotation axis. The way I was getting rotation axis was subtracting current point position from position of the previous point. And there is one thing I can't understand is subtracting central point from current position and then adding it back. What is it for ?
@P -= pos;
@P *= R;
@P += pos;
Edited by maxpayne - April 1, 2020 14:36:53
User Avatar
Member
472 posts
Joined: July 2005
Offline
“pos” is the point of the curve, where @P has closest distance. This point is our rotation center and we have to substract it,

because we want to rotate around this point. After we performed the rotation around zero we have add “pos” again to move all points

back to their old position (but rotated now). Rotations are always around zero, so if you want to rotate around any point you have to

subtract it first, rotate and add this point again.

The way you have calculated the tangents should also work, but there are many way how you can do this. With “orientation along curve”

or “polyframe” (only for tangents) you have some options.
User Avatar
Member
39 posts
Joined: Dec. 2010
Offline
Thank you for explanation. That is what I was missing.
  • Quick Links