# Planetside Software Forums

## General => File Sharing => Topic started by: mogn on May 07, 2011, 09:33:58 am

Title: symmetric spline wavefunction
Post by: mogn on May 07, 2011, 09:33:58 am
In this wave function you have control over:

the line along which the wave is generated
the wavelength
the amplitude 1 and 2 third of the wavelength
the amplitude in the middle of the wave.

The wave has zero amplitude and gradient in the end points.
Uses a 6 order spline.

Title: Re: symmetric spline wavefunction
Post by: Hetzen on May 07, 2011, 05:37:23 pm
Thanks Mogn. I always like to have a look at how you do things. I'm not sure how the math works with the dot product giving you the cos of the resultant angle, but I like it. It's one of those nodes I've never used, or found a use for before. But you've made this network easy to follow, and I can see this being very useful in the future. By my understanding, the modulo will give you parallel ramps in any direction defined by the top left constant vector.

Out of interest, how would you go about creating a vector direction from say an angle in a 360 arc defined by a constant scaler?

Thanks for sharing. Much appreciated.

Jon
Title: Re: symmetric spline wavefunction
Post by: Dune on May 08, 2011, 03:51:10 am
Thanks Mogn, very interesting. I'll check it out.
Title: Re: symmetric spline wavefunction
Post by: mogn on May 08, 2011, 04:41:16 am
The documentation of the dot function is partly wrong and not usable.
A better definition is: [A, B, C] dot [x, y, z] == [Ax, By, Cz]

Converting an arc scalar v to a vector:
Vector = [cos(v), 0, sin(v)]
Title: Re: symmetric spline wavefunction
Post by: jo on May 09, 2011, 12:59:44 am
Hi Jon,

Quote from: Hetzen on May 07, 2011, 05:37:23 pm
Out of interest, how would you go about creating a vector direction from say an angle in a 360 arc defined by a constant scaler?

You can use the rotate function nodes for that. They rotate about the origin so if you need to rotate about another point you may need to do a bit more work.

Regards,

Jo
Title: Re: symmetric spline wavefunction
Post by: mogn on May 09, 2011, 03:45:36 pm
The backside of the rotation function is that thr angle cannot be calculated by blue notes.

Before anybody discovers the errors in my calculations, I must go back to the drawingbord.
Title: Re: symmetric spline wavefunction
Post by: Hetzen on May 11, 2011, 06:45:12 am
Quote from: jo on May 09, 2011, 12:59:44 am
Hi Jon,

Quote from: Hetzen on May 07, 2011, 05:37:23 pm
Out of interest, how would you go about creating a vector direction from say an angle in a 360 arc defined by a constant scaler?

You can use the rotate function nodes for that. They rotate about the origin so if you need to rotate about another point you may need to do a bit more work.

Regards,

Jo

Thanks Jo.

As Mogn has mentioned, the values are then locked in the Rotation node, so can't be used in further parts of the calculation, or modulated to animate for example.

Cheers

Jon
Title: Re: symmetric spline wavefunction
Post by: Hetzen on May 11, 2011, 06:47:15 am
Quote from: mogn on May 08, 2011, 04:41:16 am
The documentation of the dot function is partly wrong and not usable.
A better definition is: [A, B, C] dot [x, y, z] == [Ax, By, Cz]

Converting an arc scalar v to a vector:
Vector = [cos(v), 0, sin(v)]

Thanks again Mogn. It really is that simple.

I'm slowly re-remembering my trig class at school.  ;D
Title: Re: symmetric spline wavefunction
Post by: jo on May 11, 2011, 07:37:25 am
Hi mogn,

Quote from: mogn on May 09, 2011, 03:45:36 pm
The backside of the rotation function is that thr angle cannot be calculated by blue notes.

Ah, right, of course. Sorry for the misdirection.

Regards,

Jo
Title: Re: symmetric spline wavefunction
Post by: neon22 on May 15, 2011, 09:49:47 pm
Mogn - can you put the wave shape modifier into this too. (That Hetzen, Dune and others have been working on in this thread:
http://forums.planetside.co.uk/index.php?topic=6111.0)
I.e. based on whether the sine is going up or down - push it out or back...
Title: Re: symmetric spline wavefunction
Post by: mogn on May 17, 2011, 04:02:24 am
If I correct my algorithm, such that the middle amplitude is fixed and the amplitude in a fixed point between 0 and the middle point
is specified, this arrangment can be changed in the following way:

subtract the mod value from the scaled axis giving a number N for each wave.
calculate x= mod(PI*(N*(N+1),1)*0.4
use x instead if the fixe point between 0 and 0.5

This will give a wave with fixed wavelengt fixed max amplitude, but each wave has a different form.

correcting my algorith involves solving two equations with two variables:

A*f(x   ) + B*G(x  ) = amplitude at x
A*f(0.5) + B*g(0.5) = amplitude at 0.5

where f(x) = ((1-x)*x)**2 *((1-x)**2 + x**2)
g(x) = (1-x)**3 * x**3

The wave function being A*f(s) + B*g(s) where s is running from 0 to 1.0
Title: Re: symmetric spline wavefunction
Post by: mogn on May 18, 2011, 02:20:14 pm
The node network used to solve two equations in two unknown is:
Title: Re: symmetric spline wavefunction
Post by: mogn on May 21, 2011, 08:06:15 am
Updated Wavefunction.

If you draw a line between the points X!,Y! and X2,Y2 and the lines crosses the axis in a point > 1/3 the wave
starts and ends with a valley (values less than zero). if the crossing point is less than 1/3 the middle points lies in a
valley.
Title: Re: symmetric spline wavefunction
Post by: neon22 on May 21, 2011, 05:37:45 pm
amazing skills !! I am astounded...

FYI - for ocean waves - Trochoids are a close match.
Trochoid math:

• http://userpages.monmouth.com/~chenrich/Trochoids/Trochoids.html

• http://mathworld.wolfram.com/Trochoid.html

• http://hyperphysics.phy-astr.gsu.edu/hbase/waves/watwav2.html

• http://www.scribd.com/doc/47470325/TROCHOIDAL-WAVE-THEORY

Animation paper: