Advertisement
Guest User

WalkFunction

a guest
Nov 28th, 2014
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.92 KB | None | 0 0
  1. /*
  2. * CA Winter 2014/15
  3. * Name, Vorname: Bargiel, Milan
  4. * Matrikelnummer: 11085631
  5. * Aufgabenblatt: 08
  6. * Aufgabe: 8.1
  7. */
  8. package aufgabenblatt_08.m11085631;
  9.  
  10. import math.Vec3;
  11. import math.function.FunctionR1Vec3;
  12.  
  13. public class WalkFunction extends FunctionR1Vec3 {
  14.    
  15.     private final float amplitude;
  16.     private final float circFreq;
  17.     private final float phase;
  18.     private final float d;
  19.    
  20.     public WalkFunction(float phase) {
  21.         super(Float.NEGATIVE_INFINITY, Float.POSITIVE_INFINITY);
  22.         this.amplitude = 20.0f; // Maximale Auslenkung
  23.         this.d = 10.0f; // Verschiebung auf Y-Achse
  24.         this.circFreq = (float)Math.PI; //Kreisfrequenz
  25.         this.phase = phase; // Möglichkeit der Anpassung der Phase
  26.     }
  27.        
  28.     @Override
  29.     public Vec3 eval(float t) {
  30.         return new Vec3 ((float) Math.toRadians(amplitude * Math.cos(circFreq * t + phase) + d), 0 , 0);
  31.     }
  32.    
  33.    
  34.     public String toString() {
  35.         return "WalkFunction(x)";
  36.     }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement