Absolutely brilliant! I must admit I don't remember much about cosine trigonometry from school.
Though it's never too late to re-learn it. There is no excuse, since we all have access to the 100% free "Khan Academy" if we want to learn cos, sin and other trigonometric functions.
Again, I'm both very impressed and also very thankful. I've been fruitlessly working on a desert scene for a while now. You are nailing the look I am looking for.
Btw, in my own dune scene, I've also implemented giant sand dune mountains, similar to "Big Daddy" in Namibia.
I'll share it with you, though I don't think you need any help.
Besides, I've got some rendering issues due to having been using the "intersect displacement" functions. I've been trying to implement star dunes as well, that's why I've used intersect.
Big Daddy in Namibia: