Skip to content

Commit

Permalink
small refactor OlGeometry.java
Browse files Browse the repository at this point in the history
  • Loading branch information
Zelaux committed Feb 15, 2025
1 parent c9c2467 commit 90a7dd0
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/omaloon/utils/OlGeometry.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,16 @@ public static boolean calculateIntersectionPointOfCircles(Vec2 a, Vec2 b, float
}

private static void setMatrix(Vec2 a, Vec2 b, float[] matrix, int i){
matrix[i] = a.x - b.x;
matrix[i + 1] = a.y - b.y;
float ax = a.x;
float ay = a.y;
float bx = b.x;
float by = b.y;

matrix[i] = ax - bx;
matrix[i + 1] = ay - by;
// matrix[i++] = ((b.y + a.y) * (b.y - a.y) - (a.x + b.x) * (a.x - b.x)) / 2;
// matrix[i + 2] = ((b.y * b.y - a.y * a.y) - (a.x * a.x - b.x * b.x)) / 2;
matrix[i + 2] = (b.y * b.y + b.x * b.x - a.x * a.x - a.y * a.y) / 2;
matrix[i + 2] = (by * by + bx * bx - ax * ax - ay * ay) / 2;
// matrix[i + 2] = (b.len2() - a.len2()) / 2;
}

Expand Down

0 comments on commit 90a7dd0

Please sign in to comment.