Every polygons have their vertexes of each mountain & valley.
This dyn returns both separated lists from series of closed curves.
I used Curve.ExtendEnd and determin whether the points at each extended lines are inside of the polygon or not.
While I was creating it, I found it that when mutiple elements are selected from Revit, Dynamo makes a list in order of the elements created order in Revit. And it can make errors as below image.
To avoid this error, curves were joined to a polycurve then exploded to each curves again.
It has two different effects. Reorganizing "order" and "directions" of curves.
It works well.. but I found a bug. In what reason, when geometries on mountain vertexes are imported to Revit, they scaled down sometimes.
Hope it corrected on the next version.
You can download the dyn file here.