# Best method for curved surfaces

**URL:** <https://forum.kirupa.com/t/best-method-for-curved-surfaces/299155>\
**Category:** flash\
**Created:** [October 30, 2009, 5:48pm UTC](https://forum.kirupa.com/t/best-method-for-curved-surfaces/299155 "2009-10-30T17:48:21Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ikg](https://avatars.discourse-cdn.com/v4/letter/i/8797f3/32.png) [@ikg](https://forum.kirupa.com/u/ikg)\
**Post date:** [October 30, 2009, 5:48pm UTC](https://forum.kirupa.com/t/best-method-for-curved-surfaces/299155/1 "2009-10-30T17:48:21Z")

</div>

So I have a ground that’s supposed to be, for the most part, curved.  
How can I find the utmost y point of the ground at a given x?

The ground looks like so:  
 ![](http://forum.kirupa.com/uploads/kirupa/5906/808330cde3d98f06.jpg)

The function I have right now sort-of works, but seems  
very inefficient. You input an x parameter, and the function loops  
using hitTestPoint with a constant x and a y that increases until  
it hits the ground. Then it returns that y value.

Is there a better way to do this?  
This method seems like it would get slow.  
Any help is appreciated. 🙂
