Creating surface by offsetting an open 2D curve (like Illustrator's offset path functionality.)

   7862   6   2
User Avatar
Member
29 posts
Joined: Oct. 2015
Offline
Hi, I'm new to houdini so I'm probably approaching this from the wrong angle, but is it possible to replicate Adobe Illustrator's offset path command in houdini, with control over roundness of the open ends?

I managed to create a straight edged version by offsetting each point, and then connecting with the original points in an attribute wrangler. However I can't think of a straightforward way to make the ends round.

I also tried abusing the sweep sop to create a flattened swept surface, but it is not ideal as it generates a lot of unnecessary self intersecting geometry.

I'm attaching a screenshot of what I'm trying to achieve and a hiplc file with 2 attempts I'm not happy with.

Side question - is it possible to project a piece of geometry (say with ray SOP) onto a plane, and get a clean contour curve of the projection?

Attachments:
aiOffsetPath.jpg (72.7 KB)
offsetCurveQuestion.hiplc (141.7 KB)

User Avatar
Member
2164 posts
Joined: Sept. 2015
Offline
If you don't mind writting some of your own VEX function, it is possible.

Using one of the VEX spline functions you can define how many points along your curve you want to resolve for ( in effect creating the resolution of the curve much like what you can do with a resample node ).

Then taking those points returned by the function ( spline ) you simply run another function you've written that utilizes the VEX addprim function to draw the resulting spline.

The initial VEX spline function has two arguments that define the starting and ending points and of course the ‘handles’ of the splines points - positions.

With another function you can transpose the positions according to how you want it to offset.

This would be the one function that is likely to take you the most work ( if you consider it worthwhile to pursue the time it would take to work out the algorithm ). For example in the above image you provided it might take 4 different approaches. One for the outer, inner and the two ‘endcaps’. And even for say the ‘outer’ offset the start and end would be different; The endpoint of the green line at the top transposed vertically up while the endpoint of the green lines bottom transposed horizontal to the right.

It would take a good amount of work to write it out but the end result is that you have a tool that can not only do offsets but you could easily customize how they offset, eg. offset gradiently in that the ends offset less than near the middle of the line. You could also offset in the way that mimics a pattern. You also wouldn't be limited to offseting along a 2d plane. Your offsets could be in any 3d apace; Think - spirals.
User Avatar
Member
719 posts
Joined: Sept. 2013
Online
PolyExpand followed by Convert set to ‘NURBS curve’.
Edited by Konstantin Magnus - Feb. 6, 2017 20:22:39

Attachments:
offset.hipnc (56.2 KB)

https://procegen.konstantinmagnus.de/ [procegen.konstantinmagnus.de]
User Avatar
Member
29 posts
Joined: Oct. 2015
Offline
Thanks for the replies guys,

BabaJ
If you don't mind writting some of your own VEX function, it is possible.
That's what I'm aming for, will update the post if I figure it out. Looking at a couple of other posts by you to get clues ( https://www.sidefx.com/forum/topic/45672/ [sidefx.com] and https://www.sidefx.com/forum/topic/47566/ [sidefx.com] ).

I was hoping there were a native bezier curve, which would allow me to use something like this http://stackoverflow.com/questions/1734745/how-to-create-circle-with-b%C3%A9zier-curves [stackoverflow.com] and create a circle out of 4 points only, but as far as I understand there isn't one available through vex. I'll have to approximate with a polyline.


Konstantin Magnus
PolyExpand followed by Convert set to ‘NURBS curve’.
Thanks Konstantin, poly_expand is very close to what I need, but I wasn't able to get the two side edges (the thickness) to be precisely 0 and 90 degrees - the angle depends on the divisions of the original circle, and so does the roundness of the end curves.
Shifting the first vertex so the break in tangent “continuity” is less noticeable is a neat trick, but ideally I'd like it to be a clean, continuous curve.

Edited by Lyubomir Popov - Feb. 11, 2017 10:47:48
User Avatar
Member
719 posts
Joined: Sept. 2013
Online
You can also use the resample node and treat polygons as subdivision curves to make it even simpler. But yeah..

Attachments:
offset_resample.hipnc (54.5 KB)

https://procegen.konstantinmagnus.de/ [procegen.konstantinmagnus.de]
User Avatar
Member
719 posts
Joined: Sept. 2013
Online
Or you just put half circles at each end.

Attachments:
offset_half_circles.hipnc (75.5 KB)

https://procegen.konstantinmagnus.de/ [procegen.konstantinmagnus.de]
User Avatar
Member
29 posts
Joined: Oct. 2015
Offline
Konstantin Magnus
Or you just put half circles at each end.

This is perfect! Thank you.
  • Quick Links