Answer to a comment in “RGB Transform” about nonlinear distributions


#1

Samuel Higgins asked a bit of explanation about what I mean with “…the groups of horizontal mullions follow a nonlinear distribution controlled by splines drawn in Revit”. Sadly I have seen its comment rather late. But better late than never….

Imagine that you are making a distribution of points in a curve (Cu):
-If you think in equal distance you will make point at distance with 0…(Cu.Length)…#NumberOfDivisions
-But maybe you prefer a not linear distribution of points. For sure you can define a mathematical expression. But won’t it be nicer just to draw a spline and let Dynamo to “read” our design intention?
-You can define a very simple function that takes the spline and return a list of values between 0…1 following, for example, the proportion of the X increment. Later you can use that list for making points in the original curve, with a non linear distribution controlled by the spline.
def ParByCurve(DCu,NPt)
{
Pts1=DCu.PointAtDistance(0…(DCu.Length)…#NPt);
ParVar=(Pts1.X-Pts1[0].X)/ (Pts1[NPt-1].X-Pts1[0].X);

return=ParVar;
}
02
This is just a very little sample. But things become really interesting when you use this for controlling UV surface divisions.


#2

Yes, this is quite elegant, and should probably be a UI node :slight_smile: