Everything can now be drawn
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
package Vector;
|
||||
|
||||
import static java.lang.Math.*;
|
||||
import static processing.core.PApplet.cos;
|
||||
import static processing.core.PApplet.sin;
|
||||
|
||||
public class Vector {
|
||||
public float x = 0;
|
||||
@@ -82,4 +84,10 @@ public class Vector {
|
||||
public float angle(){
|
||||
return (float) atan2(y, x);
|
||||
}
|
||||
|
||||
public Vector rotate2D(float angle){
|
||||
float distance = mag();
|
||||
float currentAngle = this.angle();
|
||||
return new Vector(cos(currentAngle + angle), sin(currentAngle + angle)).mul(distance);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user