• Create Account

### #Actualhaegarr

Posted 10 August 2012 - 07:59 AM

The way you compute wave1(x,z) uses dir_vertex, which itself is a function of (x,z). The way you compute tan1 and bitan1 neglect this fact! Notice that alvaro hinted at computing the derivates dF(x,z)/dx and dF(x,z)/dz.

In fact, the formula you use is something like
wave1(x,z) := ( sin( fs * ( dirx * x + dirz * z ) + ft * t + p ) )2
where fs denoting a spatial frequency, ft denoting a temporal frequency, and p denoting a phase.

For the purpose of spatial derivative the term ft * t + p =: ct is a constant, and fx := fs * dirx, fz := fs * dirz can be used for simplicity. Then IIRC the derivatives are
tan1 := d wave(x,z) / d x = ( sin( fx * x + fz * z + ct ) )2 / d x = 2 sin( fx * x + fz * z + ct ) * cos( fx * x + fz * z + ct ) * fx
and
bitan1 := d wave(x,z) / d z = ( sin( fx * x + fz * z + ct ) )2 / d z = 2 sin( fx * x + fz * z + ct ) * cos( fx * x + fz * z + ct ) * fz
due to the chain rule. Please check this twice.

### #7haegarr

Posted 10 August 2012 - 07:50 AM

The way you compute wave1(x,z) uses dir_vertex, which itself is a function of (x,z). The way you compute tan1 and bitan1 neglect this fact! Notice that alvaro hinted at computing the derivates dF(x,z)/dx and dF(x,z)/dz.

In fact, the formula you use is something like
wave1(x,z) := ( sin( fs * ( dirx * x + dirz * z ) + ft * t + p ) )2
where fs denoting a spatial frequency, ft denoting a temporal frequency, and p denoting a phase.

For the purpose of spatial derivative the term ft * t + p =: ct is a constant, and fx := fs * dirx, fz := fs * dirz can be used for simplicity. Then IIRC the derivatives are
tan1 := d wave(x,z) / d x = ( sin( fx * x + fz * z + ct ) )2 / d x = 2 sin( fx * x + fz * z + ct ) * cos( fx * x + fz * z + ct ) * fx
and
bitan1 := d wave(x,z) / d z = ( sin( fx * x + fz * z + ct ) )2 / d z = 2 sin( fx * x + fz * z + ct ) * cos( fx * x + fz * z + ct ) * fz
due to the chain rule. Please check this twice.

### #6haegarr

Posted 10 August 2012 - 07:48 AM

The way you compute wave1(x,z) uses dir_vertex, which itself is a function of (x,z). The way you compute tan1 and bitan1 neglect this fact! Notice that alvaro hinted at computing the derivates dF(x,z)/dx and dF(x,z)/dz.

In fact, the formula you use is something like
wave1(x,z) := ( sin( fs * ( dirx * x + dirz * z ) + ft * t + p ) )2
where fs denoting a spatial frequency, ft denoting a temporal frequency, and p denoting a phase.

For the purpose of spatial derivative the term ft * t + p =: ct denotes a constant, and fx := fs * dirx, fz := fs * dirz can be used for simplicity. Then IIRC the derivatives are
tan1 := d wave(x,z) / d x = ( sin( fx * x + fz * z + ct ) )2 / d x = 2 sin( fx * x + fz * z + ct ) * cos( fx * x + fz * z + ct ) * fx
and
bitan1 := d wave(x,z) / d z = ( sin( fx * x + fz * z + ct ) )2 / d z = 2 sin( fx * x + fz * z + ct ) * cos( fx * x + fz * z + ct ) * fz
due to the chain rule. Please check this twice.

### #5haegarr

Posted 10 August 2012 - 07:47 AM

The way you compute wave1(x,z) uses dir_vertex, which itself is a function of (x,z). The way you compute tan1 and bitan1 neglect this fact! Notice that alvaro hinted at computing the derivates dF(x,z)/dx and dF(x,z)/dz.

In fact, the formula you use is something like
wave1(x,z) := ( sin( fs * ( dirx * x + dirz * z ) + ft * t + p ) )2
where fs denoting a spatial frequency, ft denoting a temporal frequency, and p denoting a phase.

For the purpose of spatial derivative the term ft * t + p =: ct denotes a constant, and fx := fs * dirx, fz := fs * dirz can be used for simplicity. Then IIRC the derivatives are
tan1 := d wave(x,z) / dx = ( sin( fx * x + fz * z + ct ) )2 / dx = 2 sin( fx * x + fz * z + ct ) * cos( fx * x + fz * z + ct ) * fx
and
bitan1 := d wave(x,z) / dz = ( sin( fx * x + fz * z + ct ) )2 / dx = 2 sin( fx * x + fz * z + ct ) * cos( fx * x + fz * z + ct ) * fz
due to the chain rule. Please check this twice.

### #4haegarr

Posted 10 August 2012 - 07:47 AM

The way you compute wave1(x,z) uses dir_vertex, which itself is a function of (x,z). The way you compute tan1 and bitan1 neglect this fact! Notice that alvaro hinted at computing the derivates dF(x,z)/dx and dF(x,z)/dz.

In fact, the formula you use is something like
wave1(x,z) := ( sin( fs * ( dirx * x + dirz * z ) + ft * t + p ) )2
where fs denoting a spatial frequency, ft denoting a temporal frequency, and p denoting a phase.

For the purpose of spatial derivative the term ft * t + p =: ct denotes a constant, and fx := fs * dirx, fz := fs * dirz can be used for simplicity. Then IIRC the derivatives are
tan1 := d wave(x,z) / dx = ( sin( fx * x + fz * z + ct ) )2 / dx = 2 sin( fx * x + fz * z + ct ) * cos( fx * x + fz * z+ ct ) * fx
and
bitan1 := d wave(x,z) / dz = ( sin( fx * x + fz * z + ct ) )2 / dx = 2 sin( fx * x + fz * z + ct ) * cos( fx * x + fz * z+ ct ) * fz
due to the chain rule. Please check this twice.

### #3haegarr

Posted 10 August 2012 - 07:45 AM

The way you compute wave1(x,z) uses dir_vertex, which itself is a function of (x,z). The way you compute tan1 and bitan1 neglect this fact! Notice that alvaro hinted at computing the derivates dF(x,z)/dx and dF(x,z)/dz.

In fact, the formula you use is something like
wave1(x,z) := ( sin( f1 * ( dirx * x + dirz * z ) + f2 * t + p ) )2
where f1, f2 denoting frequencies, and p denoting a phase.

For the purpose of spatial derivative the term f2 * t + p =: ct denotes a constant, and fx := f1 * dirx, fz := f1 * dirz can be used for simplicity. Then IIRC the derivatives are
tan1 := d wave(x,z) / dx = ( sin( fx * x + fz * z + ct ) )2 / dx = 2 sin( fx * x + fz * z + ct ) * cos( fx * x + fz * z+ ct ) * fx
and
bitan1 := d wave(x,z) / dz = ( sin( fx * x + fz * z + ct ) )2 / dx = 2 sin( fx * x + fz * z + ct ) * cos( fx * x + fz * z+ ct ) * fz
due to the chain rule. Please check this twice.

PARTNERS