Skip to content

Instantly share code, notes, and snippets.

@thecodewarrior
Last active May 12, 2018 20:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thecodewarrior/6548b79da8e941c2b452785f74c152dc to your computer and use it in GitHub Desktop.
Save thecodewarrior/6548b79da8e941c2b452785f74c152dc to your computer and use it in GitHub Desktop.
The full import/export format for http://www.falstad.com/ripple
http://www.falstad.com/ripple/Ripple.html
the format for the import/export from text
$ 1 <resolution> <A> ? <wave type> <brightness> <scale factor>
// World start, each side is <resolution> units long
// <resolution>/<A> ~= 8
// 65.2*<scale factor> ~= world side length
// <start X> <start Y>: the origin of the object
// <end X> <end Y>: the end point or opposite corner of the object, whichever applies
// <rotation> is the angle in radians with 0 being up normal/mouse above object, with positive angles moving counter-clockwise
w ? <start X> <start Y> <end X> <end Y>
// wall
203 ? <start X> <start Y> <end X> <end Y> <slit count> <slit width> <slit separation>
// slit
b ? <start X> <start Y> <end X> <end Y> <rotation>
// box
s ? <X> <Y> <type> <wavelength factor> <phase> <length> <delay>
// point source
// <phase> = phase offset in radians
// wavelength = 30/<wavelength factor> * <scale factor>
// <type>: 0 = sine, 1 = pulse, 2 = packet
S <gaussian> <start X> <start Y> <end X> <end Y> <type> <wavelength factor> <phase> <length> <delay>
// line source
// <gaussian>: 0 = false, 1 = true
// <phase> = phase offset in radians
// wavelength = 30/<wavelength factor> * <scale factor>
// <type>: 0 = sine, 1 = pulse, 2 = packet
200 ? <X> <Y> <first source X> <first source Y> <type> <wavelength factor> <phase> <length> <delay> <source count>
// multi-pole source
// <first point X/Y> = position of one of the sources. other positions are inferred by rotating this around the object origin
// <phase> = phase offset in radians
// wavelength = 30/<wavelength factor> * <scale factor>
// <type>: 0 = sine, 1 = pulse, 2 = packet
201 ? <start X> <start Y> <end X> <end Y> <type> <wavelength factor> <phase offset 1> <length> <delay> <phase offset 2>
// phased array source
// <phase> = phase offset in radians
// wavelength = 30/<wavelength factor> * <scale factor>
// <type>: 0 = sine, 1 = pulse, 2 = packet
202 ? <start X> <start Y> <end X> <end Y> <rotation> ?
// solid box
W ? <start X> <start Y> <end X> <end Y> <rotation> <move duration> <pause duration>
// moving wall
d ? <start X> <start Y> <end X> <end Y> <type> <wavelength factor> <phase> <length> <delay> <move duration> <pause duration>
// moving source
c ? <start X> <start Y> <end X> <end Y> <rotation> <opening radius>
m ? <start X> <start Y> <end X> <end Y> <rotation> <IOR factor>
// medium
// index of refraction = sqrt(1/<IOR factor>)
M ? <start X> <start Y> <end X> <end Y> <rotation> <x mode> <y mode> <randomize> <draw box>
// mode box
g ? <start X> <start Y> <end X> <end Y> <rotation> <IOR factor 1> <IOR factor 2>
// gradient
// index of refraction = sqrt(1/<IOR factor>)
e ? <start X> <start Y> <end X> <end Y> <rotation>
// ellipse
t ? <start X> <start Y> <end X> <end Y> <rotation> <IOR factor>
// prism, empty corner is bottom right
// index of refraction = sqrt(1/<IOR factor>)
E ? <start X> <start Y> <end X> <end Y> <rotation> <IOR factor>
// ellipse medium
// index of refraction = sqrt(1/<IOR factor>)
p ? <start X> <start Y> <end X> <end Y> <rotation>
// parabola
| ? <start X> <start Y> <end X> <end Y> <rotation> <IOR factor>
// lens, bottom is flat
// index of refraction = sqrt(1/<IOR factor>)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment