Road from curve

   2394   7   1
User Avatar
Member
41 posts
Joined: April 2020
Offline
Hi everybody,

I'm trying to create a road from a 3D curve. I tried PolyExpand, Sweep and PolyExtrude. They basically work but the result is twisted in (more or less) random directions. I'd like to have every segment parallel to the XZ plane.
What am I doing wrong? Or how would I do that?
HIP file is attached.
Thanks in advance!

Günther

Image Not Found

Attachments:
Staatz.hiplc (128.7 KB)

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

PolyExpand works, but only on planar curves. Your curve is not planar but you can make temporary planar by setting the y to 0. After Expand you can write the original y-value back.

Attachments:
Staatz_planar_y.hipnc (133.6 KB)

User Avatar
Member
41 posts
Joined: April 2020
Offline
Wow, that was quick! And even better: it works!
Thanks a lot Aizatulin!
And it makes me getting deeper into AttributeWrangle! ;-)
User Avatar
Member
41 posts
Joined: April 2020
Offline
Sorry to fire up this thread again.
Everything's fine with PolyExpand but I also need more complex shapes and that leads me to sweep and there the same problem persists. The shape is copied along the curve but it is also twisted, that means it is also rotated around the z axis.
Is there a simple VEX snippet that sets the z rotation to zero?
User Avatar
Member
504 posts
Joined: July 2005
Offline
Setting the up vector (v@up = set(0,1,0)) in a point wrangle should work.
User Avatar
Member
41 posts
Joined: April 2020
Offline
Hi Aizatulin,

funny, because that's pretty close to what I found out! :-)
I used "@N.y = 0;"
Although I'm not sure WHY it works...
But works perfect now with any shape.

Thanks again!
User Avatar
Member
504 posts
Joined: July 2005
Offline
Sure

on curves v@N is usually the tangent and v@up determines the up vector. The real up vector will be calculated automatically and it will be perpendicular to v@N with closest angle to v@up (afaik).
User Avatar
Member
41 posts
Joined: April 2020
Offline
Thanks for the explanation!
  • Quick Links