Mesh Color by Slope

Hi guys,

There is something I am not quite grasping about the functioning of the Mesh Colour component.

This is the desired result, but the Trees do not match and the Mesh Colour ends up generating duplicates.

Here I grafted the input so there are no duplicates but the color is not right.

My ultimate goal is to be able to identify a range of slopes for example:
0% to 6% green
7% to 20% yellow
21% to 50% orange
50% to x% red

Mesh (22.0 KB)

Does this work?

Mesh (24.6 KB)

What I did was get the min/max range of the values and input them inside the gradient. Afterwards adjust the color dots so that they are in the middle of the range you described

Check this as well.

Mesh (22.8 KB)

Hi guys, thank you both!

I ended up finding this definition by Chris Hanley and tweaked something to make it work with my case. This way I can more dynamically change the bounds of each domain with sliders.

I took away the average component from the original def, added the absolute as Kim did, and then also added a formula to replace the infinite values from Tan(90) with a lower number.