### Curve Resample Varying Segment Lengths

4181   10   2
Member
34 posts
Joined: Nov. 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 - June 23, 2020 08:30:47

Attachments:
example_curve.jpg (44.8 KB)

Member
1990 posts
Joined: Sept. 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 - June 23, 2020 16:51:34
Member
34 posts
Joined: Nov. 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.
Edited by TheProgg - June 23, 2020 18:04:41

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

Member
1990 posts
Joined: Sept. 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)

Member
456 posts
Joined: July 2005
Offline
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)

Member
34 posts
Joined: Nov. 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 - June 23, 2020 21:08:22
Member
77 posts
Joined: Feb. 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 - June 24, 2020 02:42:04

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

Member
34 posts
Joined: Nov. 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 - June 24, 2020 12:06:46
Member
77 posts
Joined: Feb. 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 - June 24, 2020 23:36:17
Member
34 posts
Joined: Nov. 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 - June 25, 2020 07:52:11
Member
77 posts
Joined: Feb. 2017
Offline
TheProgg