~fossgalaxy/adastra/github-track

« back to all changes in this revision

Viewing changes to src/utilities/CrazyMath.java

  • Committer: Joseph Walton-Rivers
  • Date: 2011-05-18 20:28:37 UTC
  • Revision ID: git-v1:fc4450529b286ffb87b351c478d3a39135d91d8f
UIĀ andĀ movement

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * To change this template, choose Tools | Templates
 
3
 * and open the template in the editor.
 
4
 */
 
5
 
 
6
package utilities;
 
7
 
 
8
import adastra.engine.Location;
 
9
 
 
10
/**
 
11
 *
 
12
 * @author jwalto
 
13
 */
 
14
public class CrazyMath {
 
15
 
 
16
    public static Location circularDisplacement(int mag, double degrees){
 
17
        degrees = Math.toRadians(degrees);
 
18
        double x = mag* Math.sin(degrees);
 
19
        double y = - mag* Math.cos(degrees);
 
20
        return new Location(null,(int)x,(int)y);
 
21
    }
 
22
 
 
23
}