# How to compute the surface height based on normal vectors

• dilloncyh
In summary, the question is how to compute the surface height z(x,y) given a set of normal vectors at each point (x,y) on a square grid. One method is to calculate the vectors u and v, which are orthogonal to the normal vector, and solve a system of linear equations using standard linear algebra. However, this approach is computationally slow due to the large number of points on the grid. Other possible methods include integrating along one axis or transforming the system to one-dimensional integrals, but these approaches have their own limitations.
dilloncyh
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.

thanks

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.

## 1. How do normal vectors affect surface height?

The normal vector, also known as the surface normal, is a vector that is perpendicular to the surface at a specific point. It dictates the direction in which the surface is facing. By using the normal vector, we can determine the slope and curvature of the surface, which ultimately affects the surface height.

## 2. What is the formula for computing surface height based on normal vectors?

The formula for computing surface height based on normal vectors is h = (n1x + n2y + n3z) / |n|, where n1, n2, and n3 are the components of the normal vector and |n| is the magnitude of the normal vector.

## 3. Can surface height be computed using only one normal vector?

No, surface height cannot be computed accurately using only one normal vector. The normal vector only provides information about the slope and direction of the surface at a specific point. To accurately compute surface height, we need the normal vectors at multiple points on the surface.

## 4. Are there any software tools available for computing surface height based on normal vectors?

Yes, there are several software tools available for computing surface height based on normal vectors. Some popular options include MATLAB, Python's NumPy library, and Blender.

## 5. Can surface height be computed for any type of surface using normal vectors?

Yes, surface height can be computed for any type of surface using normal vectors. As long as we have accurate normal vectors at multiple points on the surface, we can use the formula mentioned above to compute the surface height.

Replies
2
Views
2K
Replies
1
Views
2K
Replies
3
Views
1K
Replies
8
Views
849
Replies
3
Views
2K
Replies
2
Views
921
Replies
2
Views
3K
Replies
6
Views
2K
Replies
4
Views
3K
Replies
3
Views
3K