1
$\begingroup$

enter image description here

Ignoring the codes, this is more or less a calculus question. Given an equation of a surface $z = x^2 + y^2$, I need to find normal vector of a point. I am not good at maths ... so ...

For (a), I believe the $\frac{\partial z}{\partial x}$ is equation of tangent of curve created by plane $y=c$ (probably wrong strictly speaking but you get the idea) with surface $f(x, y)$. Similarly for $\frac{\partial z}{\partial y}$ is equation of tangent of curve created by plane $x=c$ with surface $f(x, y)$

For (b) is tangent vector the same as the equations found in (a)?

For (c), do I do a cross product of the partial derivatives? If so, what I don't understand is how do I map the equations to a "matrix notation form" that I am familiar to do cross product?

$\endgroup$
3
$\begingroup$

For (a), your thinking is correct.

For part (b), the tangent vector corresponding to $\frac{\partial z}{\partial x}$ is $$ z_x = \left(1, 0, \frac{\partial z}{\partial x} \right) $$ Similarly, the tangent vector corresponding to $\frac{\partial z}{\partial y}$ is $$ z_y = \left(0, 1, \frac{\partial z}{\partial y} \right) $$

For part (c), your idea of taking a cross product is correct. The surface normal is $z_x \times z_y$. You may have to unitize this vector before passing it to OpenGL.

In computer graphics, it's more common for a surface to be given by parametric equations $\mathbf{S} = \mathbf{S}(u,v)$, rather than in the form $z=f(x,y)$. Then the surface normal is simply the cross product of the partial derivative vectors: $$ \mathbf{N} = \frac{\partial \mathbf{S}}{\partial u} \times \frac{\partial \mathbf{S}}{\partial v} $$ What we have here can be considered a special case where $u=x$, $v=y$, and $\mathbf{S}(x,y) = (x, y, z(x,y))$.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.