Initial dirty commit of old code into git
This commit is contained in:
commit
5546f26619
1985 changed files with 255900 additions and 0 deletions
29
Game/src/MathShit.java
Normal file
29
Game/src/MathShit.java
Normal file
|
@ -0,0 +1,29 @@
|
|||
|
||||
public class MathShit
|
||||
{
|
||||
/**
|
||||
* Calculates the x-component of a vector, rotated around 0|0 by angle
|
||||
* @param angle angle to rotate, in radians
|
||||
* @param x old x-component of the vector or point
|
||||
* @param y old y-component of the vector or point
|
||||
* @return the new x component
|
||||
*/
|
||||
public static float rotateX(double angle, float x, float y)
|
||||
{
|
||||
double beta = (2*Math.PI)-angle;
|
||||
return (float) (Math.cos(beta)*x-Math.sin(beta)*y);
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates the y-component of a vector, rotated around 0|0 by angle
|
||||
* @param angle angle to rotate, in radians
|
||||
* @param x old x-component of the vector or point
|
||||
* @param y old y-component of the vector or point
|
||||
* @return the new y-component
|
||||
*/
|
||||
public static float rotateY(double angle, float x, float y)
|
||||
{
|
||||
double beta = (2*Math.PI)-angle;
|
||||
return (float) (Math.sin(beta)*x+Math.cos(beta)*y);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue