Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

How to compute the surface height based on normal vectors

  1. May 12, 2015 #1
    Suppose I have already found the surface normal vectors to a set of points (x,y), how do I compute the surface height z(x,y)?

    Basically what I have are the normal vectors at each point (x,y) on a square grid. Then I calculate the vectors u = (x+1,y,z(x+1,y)) - (x,y,z(x,y)) and v = (x,y+1,z(x,y+1)) - (x,y,z(x,y)), and use the facts that u and v are both orthogonal to the the normal vector at (x,y) to obtain a system of linear-equations which can be solved by using standard linear algebra. The problem is that since there are many points on the grid (the number of pixel on a 200x300 image), this system of equations is very very large, and the computational time is very slow. So I wonder if there are other methods to compute the surface height z(x,y) from the given set of normal vectors.

  2. jcsd
  3. May 12, 2015 #2


    User Avatar
    2017 Award

    Staff: Mentor

    If you integrate along one axis (let's say x), the derivative of z with respect to x should be a simple function of your normal vector components.
    You can get to every point with two one-dimensional integrations. Not sure about the numeric stability of that approach, but that is easy to check with real examples.
    You can also transform your system and make just one-dimensional integrals but then the discrete spacing of the points could get ugly.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook