Guest User

Untitled

a guest
Jul 16th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.47 KB | None | 0 0
  1. package oving8;
  2.  
  3. public class Direction {
  4.     public int _iAngle = 0;
  5.     public void setDirection(int iDirection) {
  6.         this._iAngle = iDirection%360;
  7.     }
  8.     public void incrementDirection(int iDirection) {
  9.         this.setDirection(this._iAngle + iDirection);
  10.     }
  11.    
  12.     public Vector getUnitVector() {
  13.         double dRadians = this.getRadians();
  14.         return new Vector(Math.sin(dRadians), Math.cos(dRadians));
  15.     }
  16.    
  17.     private double getRadians() {
  18.         return this._iAngle*Math.PI/180;
  19.     }
  20. }
Add Comment
Please, Sign In to add comment