Skip to content

Instantly share code, notes, and snippets.

@Sunjammer
Created March 2, 2015 15:05
Show Gist options
  • Save Sunjammer/23b0556e0dd43e72286b to your computer and use it in GitHub Desktop.
Save Sunjammer/23b0556e0dd43e72286b to your computer and use it in GitHub Desktop.
Lissajous utils
public class Lissajous {
public static function lissajousKnot(t:Float, a:Int, b:Int, c:Int, ap:Float, bp:Float, cp:Float, out:{x:Float,y:Float,z:Float}) {
t *= 6.28;
out.x = Math.cos(a * t + ap);
out.y = Math.cos(b * t + bp);
out.z = Math.cos(c * t + cp);
}
public static function lissajousCurve(t:Float, a:Int, b:Int, out:{x:Float, y:Float}) {
t *= 6.28;
out.x = a * Math.sin(a * t + t);
out.y = b * Math.sin(b * t);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment