Cannot scale with factor zero

I want to scale a base triangle with decreasing size(at different heights). In the scale component, I am feeding series (0, 1/N, 2/N, …, N) as scaling factor(N is the number of stories). It works fine if the series is 1, 1/3, 2/3, 0 but shows the above error if the series is 1, 0.75, 0.5, 0.25, 0. Why is it behaving differently?
MTP_2.gh (35.1 KB)

category should be grasshopper

1 Like

Hi. I have checked your script and see the problem. Interestingly it occurs with N being 1,2,4,8,16,32,64 and so on. Unfortunately I don’t know why this happens. But as a work around you can use the standard ScaleNU component instead. It does the same, if you connect like shown here:

Hope that helps.

1 Like

Thank you so much, that solves the problem.

This seems to be an issue of precision.
The scale component cannot use a factor of 0, but it can use a factor that is very close to 0.
With N = 3, the final value in the series of scale factors is not 0, but 1.11x10^-16 - i.e. a very tiny number close to 0 but not quite at 0.

You could use the Range component, and set the domain from 1 to 0.001, to ensure that different values of N always produce non-zero scaling factors.

1 Like