Curve Resample Varying Segment Lengths

   6701   14   4
User Avatar
Member
34 posts
Joined: 11月 2016
Offline
I am trying to come up with a simple way to divide a curve up into varying length sections, however the sections themselves would be limited by user input for possible lengths. Dividing the curve up evenly by a fixed distance is easy enough with resample but I'm having trouble figuring out a way to resample the curve at varying lengths, while also ensuring that each section of the curve maintains a fixed amount of distance.

For example, taking the curve and dividing it up randomly into either 2 or 4 unit length sections. Any thoughts? Thanks!

Edited by TheProgg - 2020年6月23日 08:30:47

Attachments:
example_curve.jpg (44.8 KB)

User Avatar
Member
2129 posts
Joined: 9月 2015
Offline
Perhaps supply a curve you intend to work off initially in a hip.

Is it going to be a polyline curve or a nurbs/bezier(to start with)?

Because a nurbs/bezier won't have all of its' points on the line like you have(some are control points).

If they were all on the line then it would not be a smooth curve between points(just straight) because it would be a polyline.

So it's not clear what you want to work from since depending on that determines the approach.
Edited by BabaJ - 2020年6月23日 16:51:34
User Avatar
Member
34 posts
Joined: 11月 2016
Offline
BabaJ
Perhaps supply a curve you intend to work off initially in a hip.

Is it going to be a polyline curve or a nurbs/bezier(to start with)?

Because a nurbs/bezier won't have all of its' points on the line like you have(some are control points).

If they were all on the line then it would not be a smooth curve between points(just straight) because it would be a polyline.

So it's not clear what you want to work from since depending on that determines the approach.

Just a standard polygon curve. Sorry if the image was confusing, it does not need to be bezier. The curve is more of a template guide for the creation of building facades. Each segment of the curve would act as the starting point for a building. I attached an image and .hip file of an example case. Basically I want to divide an input curve into segments that act as starting points for buildings, but resample is only an approximate length (depending on the size of the input curve) and there's not really a way to specify different segment lengths within resample as it's all uniform. I dont want all the building fronts to be the same length, I'm trying to break them up so they could be whatever size the user wants. (i.e 2m, 4m, 6m,etc) Then the tool would cut up curve into random segment sizes based on those values.

RED is the input curve from Houdini before resampling by maximum segment size 4.




My first reaction was to start at the beginning of the curve, walk forward down the curve by one of those ‘user’ supplied distances, add a point at that location, and then continue forward another random amount and keep walking the curve until the end. Then I could just intersection stitch the new points into the curve and remove the old points. There would of course be some leftover garbage at the end that wouldnt fit into the right length.
Image Not Found
Edited by TheProgg - 2020年6月23日 18:04:41

Attachments:
building_from_curve_example.hip (142.7 KB)
example.jpg (25.6 KB)

User Avatar
Member
2129 posts
Joined: 9月 2015
Offline
I built this before your response…and I started with bezier…there would be easier solution/s if I just used a polyline to start.

But at the end of this there is a convert/resample to choose from anyways.

Attachments:
DivideUp_NurbsCurve_v0.hiplc (105.8 KB)

User Avatar
Member
495 posts
Joined: 7月 2005
Online
Hi,

you can use an array with accumulated weights for example, to set the u-values of the curve (from 0 to 1).

Here is an example

Attachments:
building_from_curve_exampleA.hipnc (151.2 KB)

User Avatar
Member
34 posts
Joined: 11月 2016
Offline
BabaJ
I built this before your response…and I started with bezier…there would be easier solution/s if I just used a polyline to start.

But at the end of this there is a convert/resample to choose from anyways.

Thanks for the example.

Aizatulin
Hi,

you can use an array with accumulated weights for example, to set the u-values of the curve (from 0 to 1).

Here is an example

I'm really digging this multiparm option in the file you provided. That is really cool approach. I really like this example. Thanks!
Edited by TheProgg - 2020年6月23日 21:08:22
User Avatar
Member
77 posts
Joined: 2月 2017
Offline
Aizatulin's example is great, and you can use attribute interpolate or intersection stitch to interpolate the point attribute from origin curve.

I use intersection stitch SOP a lot on curve, it's really a powerful SOP.

I also used array to achieve the aim.

But you may need to convert all the parameters to attributes that make the feature truly procedural.
Edited by zengchen - 2020年6月24日 02:42:04

Attachments:
test.gif (283.4 KB)
building_from_curve_exampleB.hipnc (102.7 KB)

My Youtube Channel [www.youtube.com]
User Avatar
Member
34 posts
Joined: 11月 2016
Offline
zengchen
Aizatulin's example is great, and you can use attribute interpolate or intersection stitch to interpolate the point attribute from origin curve.

I use intersection stitch SOP a lot on curve, it's really a powerful SOP.

I also used array to achieve the aim.

But you may need to convert all the parameters to attributes that make the feature truly procedural.

Great example! Is the ‘Curve Custom Split’ available in your hPro HDA tools yet? Your examples and HDAs are very helpful. Thanks
Edited by TheProgg - 2020年6月24日 12:06:46
User Avatar
Member
77 posts
Joined: 2月 2017
Offline
TheProgg
Great example! Is the ‘Curve Custom Split’ available in your hPro HDA tools yet? Your examples and HDAs are very helpful. Thanks

I plan to release my CityEngine Procedural Modeling Tools(curve custom split SOP also is part of the tools) in the future, maybe this year or next year, but not now, sorry. Because I've not completed the tools yet.
Edited by zengchen - 2020年6月24日 23:36:17
My Youtube Channel [www.youtube.com]
User Avatar
Member
34 posts
Joined: 11月 2016
Offline
zengchen
TheProgg
Great example! Is the ‘Curve Custom Split’ available in your hPro HDA tools yet? Your examples and HDAs are very helpful. Thanks

I plan to release my CityEngine Procedural Modeling Tools(curve custom split SOP also is part of the tools) in the future, maybe this year or next year, but not now, sorry. Because I've not completed the tools yet.

No problem. Those city engine tools sound really great. I look forward to seeing them, your procedural work is very good. What is the best place to follow your updates and releases?
Edited by TheProgg - 2020年6月25日 07:52:11
User Avatar
Member
77 posts
Joined: 2月 2017
Offline
TheProgg
What is the best place to follow your updates and releases?
Just at vimeo, maybe add github.
My Youtube Channel [www.youtube.com]
User Avatar
Member
77 posts
Joined: 3月 2020
Offline
zengchen
Aizatulin's example is great, and you can use attribute interpolate or intersection stitch to interpolate the point attribute from origin curve.

I use intersection stitch SOP a lot on curve, it's really a powerful SOP.

I also used array to achieve the aim.

But you may need to convert all the parameters to attributes that make the feature truly procedural.


Hello guys,

I'm now also trying to resample the curve into vary lengths. I have an array of how long each prim is gonna split into (say a 7 = 5 + 2). How can I incorporate that into your code example (I don't want to use the multiparm list but set lengths)?

Attachments:
Screenshot_1.png (334.5 KB)
Resample_Varying_Lengths.hiplc (535.4 KB)

https://huylefx.com/ [huylefx.com]
User Avatar
Member
121 posts
Joined: 6月 2020
Offline
If you don't mind maintaining the position of the input points you can simply assign a @num_segments integer attribute to each primitive using whatever logic you want and the Resample SOP will divide each primitive into the number of segments specified.
User Avatar
Member
143 posts
Joined: 6月 2024
Offline
Has anyone seen a resample option where the point is set when the tangent deviates by a certain degree or the maximum segment length? Like in Cinema. For example, 2 degrees and 10 cm. Either a deviation of 2 degrees or a length of 10 cm is reached.
User Avatar
Member
77 posts
Joined: 3月 2020
Offline
freshbaked
If you don't mind maintaining the position of the input points you can simply assign a @num_segments integer attribute to each primitive using whatever logic you want and the Resample SOP will divide each primitive into the number of segments specified.

Wow this is pretty cool! Do you happen to know a way to also control the length of each of those segments?
https://huylefx.com/ [huylefx.com]
  • Quick Links