Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package oving8;
- public class Direction {
- public int _iAngle = 0;
- public void setDirection(int iDirection) {
- this._iAngle = iDirection%360;
- }
- public void incrementDirection(int iDirection) {
- this.setDirection(this._iAngle + iDirection);
- }
- public Vector getUnitVector() {
- double dRadians = this.getRadians();
- return new Vector(Math.sin(dRadians), Math.cos(dRadians));
- }
- private double getRadians() {
- return this._iAngle*Math.PI/180;
- }
- }
Add Comment
Please, Sign In to add comment