Skip to main content
gamedev.net
🔒 Locked

Derivates

Started by GaryNas 1 reply 400+ views
Original Post
GaryNas
GaryNas
I'm a bit confused by partial derivates and their use with vectors. I've taken college and university calculus and did very well, but I just don't understand how they're used with vectors or in games. For example, in GPU Gems 1, the first chapter talks about programming water. On page 9 the author gives some equation: P(x,y,t) = (x,y,H(x,y,t)). On the next line he says

The partial derivative in the x direction is then:
B(x,y) = (@x/@x , @y/@x, @/@x(H(x,y,t)))
I have **NO** idea what this means or how he even derived that. I've also seen similar things done with normal map derivations. What part of calculus is this? Can anyone recommend some books I can pick up on this section of calculus? Thanks!
alvaro
alvaro
Imagine that the values of y and t are fixed, and x is allowed to vary. Then you can think of your function P(x,y,t) as a one-variable function P(x), whose values are vectors. The partial derivative of P(x,y,t) in the x direction is just the derivative of P(x), which is just the vector formed by the derivatives of the components of P(x).

Intuitively, when you move x a little bit and leave the other variables fixed, in what direction does the point P(x,y,t) move? That's the partial derivative.

I guess you can call this "calculus of several real variables", or something like that.

samv
samv
I think it's called Multivariable Calculus. This Wikibook may give you a few ideas, but I don't know how good it explains things.

The intuitive idea behind the partial derivative you showed is just "How does the result of P change if we change x?".
The good thing is, that this answer can be calculated independently for the three components of P. So we have three questions:

How does x change if we change x? Answer: @x/@x (= 1)
How does y change if we change x? Answer: @y/@x
How does H(x,y,t) change if we change x? Answer: @H(x,y,t)/@x

Put them together and you get @P(x,y,t)/@x = (@x/@x, @y/@x, @H(x,y,t)/@x)
_________Buggrit, millennium hand and shrimp!

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.