Everything can now be drawn

This commit is contained in:
Quinn
2023-05-02 10:28:06 -05:00
parent 3321e77061
commit 1a4d6e6909
9 changed files with 59 additions and 72 deletions

View File

@@ -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);
}
}