Curve Resample Varying Segment Lengths
6735 14 4- TheProgg
- 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!
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
- BabaJ
- Member
- 2129 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.
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
- TheProgg
- 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.
Image Not Found
Edited by TheProgg - June 23, 2020 18:04:41
- BabaJ
- Member
- 2129 posts
- Joined: Sept. 2015
- Offline
- Aizatulin
- Member
- 495 posts
- Joined: July 2005
- Offline
- TheProgg
- 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
- zengchen
- 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.
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
- TheProgg
- 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
- zengchen
- 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
- TheProgg
- Member
- 34 posts
- Joined: Nov. 2016
- Offline
zengchenTheProgg
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
- zengchen
- Member
- 77 posts
- Joined: Feb. 2017
- Offline
- huylefx
- Member
- 77 posts
- Joined: March 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)?
- freshbaked
- Member
- 121 posts
- Joined: June 2020
- Offline
- RGaal
- Member
- 143 posts
- Joined: June 2024
- Offline
- huylefx
- Member
- 77 posts
- Joined: March 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?
-
- Quick Links