Created
March 2, 2015 15:05
-
-
Save Sunjammer/23b0556e0dd43e72286b to your computer and use it in GitHub Desktop.
Lissajous utils
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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