# Clustering points gradually at locations along a curve

Is there some clever way to adjust point density of DIVIDE CURVE, EVALUATE LENGTH or EVALUATE CURVE modules?
Perhaps with an attractor?
Simply culling a large number in some places is not organic in the transition from less density to more density and leads to a lofted surface that is not as smooth

Desired - but with smooth transitions from high density to low density

This is to get more curves at the corners - resulting from bisecting a brep with the resulting planes

Corner Cluster 001.gh (9.5 KB)

Basically weighting distribution by curvature.

Corner Cluster 001-b.gh (14.1 KB)

Youâ€™ll have to play with the two sliders depending on how many points you want.

2 Likes

Thats impressive. Thank you
When I apply this code to the actual model, I get:

One end of the curve becomes a straight line
How would you handle that?
Perhaps make a sub curve and add the end point later?

Can you provide the â€śactualâ€ť curve?

Infinite curvature issue

I donâ€™t see any curve showing up.

Corner Cluster 005.gh (11.7 KB)

Apologies.

Of course, nothing ever stays simple, and this probably has more sliders than youâ€™d like. That saidâ€¦

Corner Cluster 005-b.gh (11.3 KB)

I think the fact that there is an infinite, or near infinite radius of curvature value throws off the weighting for everything else, at least for this approach.

Interesting. Thank you. This brings up another topic, which is exception handling.
Ideally, the zero curvature condition that causes an exception would be handled by substituting a large number 9999999. For this solution, that is more than adequate, but unless i missed something. there is no way to handle exceptions or test for the condition that might cause a module to throw an exception like divide by zero, ahead of time. One model. One solution. A different model, re-write the solution.

Maybe someone whoâ€™s familiar with the Rhino libraries could answer this. The curvature is probably calculated on the basis of sampling, or an actual Nurbs equation. Three collinear points in a curve will give a line with Nurbs, so I donâ€™t know at what level you could override that for the curvature. If you try the above with a "nicerâ€™ sinuous curve, it generally gives good results, but thatâ€™s cold comfort for you.

You know, I was thinking about this and I realized itâ€™s probably equivalent to a question posed here a while ago by guess who? Me! There were a couple of solutions given that I donâ€™t think will blow up in your case.

Not really sure about the division in the last example but you can always replace the Nulls with a large number (9999999) using the Replace Nulls component.

1 Like

Ah yes true BUTâ€¦ then you have a nasty orange bubble glaring at you. Its hard to sleep at night over such a dilemma

@Proterio I was gonna mention that red\orange component, but in essence, thereâ€™s nothing wrong working with an orange componentâ€¦

Agreed, as long as you understand the error.

Yes. I agree, im just hoping to make the argument for some kind of exception handling that would allow me to shut of the alarm, substitute a value, and avoid being hauled before the GH crimes tribunal on a fraudulent wiring charge )