Skip to content
Snippets Groups Projects
Commit a9f53b02 authored by Memo Akten's avatar Memo Akten
Browse files

fixes to Piers Vector2d

parent c1c73b2d
No related branches found
No related tags found
No related merge requests found
......@@ -430,12 +430,15 @@ public class Vector2d {
return ((x * v.getX()) + (y * v.getY()));
}
public static Vector2d scalarProduct(Vector2d v1, Vector2d v2) {
public static double scalarProduct(Vector2d v1, Vector2d v2) {
Vector2d vector = new Vector2d(v1, true);
vector.scalarProduct(v2);
return vector;
return vector.scalarProduct(v2);
}
public double dot(Vector2d v) { return scalarProduct(v); }
public static double dot(Vector2d v1, Vector2d v2) { return Vector2d.scalarProduct(v1, v2); }
public static Vector2d toCartesian(Vector2d input) {
double x = (input.getY() * Math.cos(input.getR()));
double y = (input.getY() * Math.sin(input.getR()));
......@@ -490,10 +493,10 @@ public class Vector2d {
}
public static Vector2d normalise(Vector2d first) {
Vector2d second = new Vector2d(first, false);
Vector2d second = new Vector2d(first, true);
second.normalise();
if (first.mutable)
second.setToMutable();
// if (first.mutable)
// second.setToMutable();
return second;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment