Thread: Obtaining the surface normal of a sphere in terms of u and v.

1. Hi Folks,

How does one get the surface normal of a sphere in terms ofthe original coordinates u and v sincethere are 3 vectors at each point as shown in the attachment? Is there a chain rule involved?

Regards
B

2. Originally Posted by bugatti79
Hi Folks,

How does one get the surface normal of a sphere in terms of the original coordinates u and v since there are 3 vectors at each point as shown in the attachment? Is there a chain rule involved?

Regards
B
Hi bugatti!

The 3 vectors seem to be 2 vectors that describe the direction of the surface, and a third vector that is perpendicular to the surface. That "normal" vector is found by taking the cross product of the 2 directional vectors.
In the case of the sphere, ultimately the normal vector is just the vector itself. That is, any vector from the origin to the sphere is also normal to the sphere - that's just a property of the sphere.

There does not really seem to be a chain rule to be involved.

Originally Posted by I like Serena
Hi bugatti!

The 3 vectors seem to be 2 vectors that describe the direction of the surface, and a third vector that is perpendicular to the surface. That "normal" vector is found by taking the cross product of the 2 directional vectors.
In the case of the sphere, ultimately the normal vector is just the vector itself. That is, any vector from the origin to the sphere is also normal to the sphere - that's just a property of the sphere.

There does not really seem to be a chain rule to be involved.
Hello :-)

Thanks for the reply. Okay but this normal vector is in terms of s and w but apparently one can get the normal in terms of the original flat terrain variables u and v. Its not clear to me how to evaluate this because J(s,w,t) isa 3*3 matrix and tu and tv are 1*3 matrix.

Here is the website link I am looking at.

4. Originally Posted by bugatti79
Hello :-)

Thanks for the reply. Okay but this normal vector is in terms of s and w but apparently one can get the normal in terms of the original flat terrain variables u and v. Its not clear to me how to evaluate this because J(s,w,t) isa 3*3 matrix and tu and tv are 1*3 matrix.

Here is the website link I am looking at.

Ah okay. Let me try to clarify.

The 3x3 matrix is to transform a relief on the top face of a cube to a relief on the sphere.
The coordinates on the top face of the cube are (s,t,1).
The relief on that face are then (s,t,h), where h is the height as function of (s,t).
Each point on the top face is transformed into a point on the sphere by simply normalizing the length of the vector (s,t,1) to 1 - now it has distance 1 to the origin, or in other words it's a point on the sphere.
Then those point get transformed into (x,y,z) by scaling the point a little bit to obtain the relief given by h.

Anyway, the J(s,t,h) matrix identifies the 2 directional vectors and the normal vector to the relief that we've mapped on top of the sphere.

Originally Posted by I like Serena
Ah okay. Let me try to clarify.

The 3x3 matrix is to transform a relief on the top face of a cube to a relief on the sphere.
The coordinates on the top face of the cube are (s,t,1).
The relief on that face are then (s,t,h), where h is the height as function of (s,t).
Each point on the top face is transformed into a point on the sphere by simply normalizing the length of the vector (s,t,1) to 1 - now it has distance 1 to the origin, or in other words it's a point on the sphere.
Then those point get transformed into (x,y,z) by scaling the point a little bit to obtain the relief given by h.

Anyway, the J(s,t,h) matrix identifies the 2 directional vectors and the normal vector to the relief that we've mapped on top of the sphere.
Hi!,

I believe I get the idea but I am interested to see thecalculation of t’u and t’v in order to get n.

T’u=J(s,t,h)*tu…how is this calculated because J is a 3*3and tu is a 1*3….

Originally Posted by bugatti79
Hi!,

I believe I get the idea but I am interested to see thecalculation of t’u and t’v in order to get n.

T’u=J(s,t,h)*tu…how is this calculated because J is a 3*3and tu is a 1*3….
In other words, how is the following calculated?

7. Originally Posted by bugatti79
Hi!,

I believe I get the idea but I am interested to see thecalculation of t’u and t’v in order to get n.

T’u=J(s,t,h)*tu…how is this calculated because J is a 3*3and tu is a 1*3….
Originally Posted by bugatti79
In other words, how is the following calculated?
What is intended, is:
$$\mathbf t_u' = \mathbf t_u J(s,t,h)$$
I don't know why it was written the other way around with a $*$.

Note that if we ony look at the first component of both $\mathbf t_u'$ and $\mathbf t_u$, we'll get:
$$\pd x u = \pd x s \pd s u + \pd x t \pd t u + \pd x h \pd h u$$
which is the chain rule as it should.
If we do it any other way, we won't get the result we need.

Usually we write vectors as 3x1 matrices, that we multiply on the right of a 3x3 matrix, such as $A\mathbf v$.
Some text books however make the choice to write vectors as 1x3 matrices, which we then have to multiply on the left as in $\mathbf v^T A^T$. The result is the transpose of what we would otherwise have, which is again a 1x3 matrix.

Originally Posted by I like Serena
What is intended, is:
$$\mathbf t_u' = \mathbf t_u J(s,t,h)$$
I don't know why it was written the other way around with a $*$.

Note that if we ony look at the first component of both $\mathbf t_u'$ and $\mathbf t_u$, we'll get:
$$\pd x u = \pd x s \pd s u + \pd y t \pd t u + \pd z h \pd h u$$
which is the chain rule as it should.
If we do it any other way, we won't get the result we need.

Usually we write vectors as 3x1 matrices, that we multiply on the right of a 3x3 matrix, such as $A\mathbf v$.
Some text books however make the choice to write vectors as 1x3 matrices, which we then have to multiply on the left as in $\mathbf v^T A^T$. The result is the transpose of what we would otherwise have, which is again a 1x3 matrix.
So the normal vector would be calculated as follows?

$\displaystyle n=t_u' \times t_v'=\begin{vmatrix} 1&1 &1 \\ x_s+f_uz_s&x_t+f_uz_t &x_h+f_uz_h \\ y_s+f_vz_s&y_t+f_vz_t &y_h+f_vz_h \end{vmatrix}=....etc$

9. Originally Posted by bugatti79
So the normal vector would be calculated as follows?

$\displaystyle n=t_u' \times t_v'=\begin{vmatrix} 1&1 &1 \\ x_s+f_uz_s&x_t+f_uz_t &x_h+f_uz_h \\ y_s+f_vz_s&y_t+f_vz_t &y_h+f_vz_h \end{vmatrix}=....etc$
I should probably do this more carefully, but I think it should be:
$\displaystyle \mathbf n'=\mathbf t_u' \times \mathbf t_v'=\begin{vmatrix} \mathbf{\hat x}& \mathbf{\hat y} & \mathbf{\hat z} \\ x_s+f_uz_h&y_t+f_uz_h &z_h+f_uz_h \\ x_s+f_vz_h&y_t+f_vz_h &z_h+f_vz_h \end{vmatrix}=...$

Originally Posted by I like Serena
I should probably do this more carefully, but I think it should be:
$\displaystyle \mathbf n'=\mathbf t_u' \times \mathbf t_v'=\begin{vmatrix} \mathbf{\hat x}& \mathbf{\hat y} & \mathbf{\hat z} \\ x_s+f_uz_h&y_t+f_uz_h &z_h+f_uz_h \\ x_s+f_vz_h&y_t+f_vz_h &z_h+f_vz_h \end{vmatrix}=...$
I think there was an error in my calculation....

$\displaystyle t_u'=t_u \times J(s,t,h)=\begin{vmatrix} 1&0 &f_u \end{vmatrix} \begin{vmatrix} x_s& y_s & z_s \\ x_t&y_t &z_t \\ x_h&y_h &z_h \end{vmatrix}=\begin{vmatrix} x_s+f_u x_h&y_s+f_u y_h &z_s+f_u z_h \end{vmatrix}$ and similarly for $\displaystyle t'_v$

This should enable us get the correct normal vector...?

Thanks
B