Skip to content

Commit

Permalink
don't use java.awt in RectangleUtil #73
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmoten committed Aug 25, 2024
1 parent ad586d0 commit 527c072
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ public boolean intersectsLine(Line2D l) {
* otherwise.
* @since 1.2
*/
private static boolean linesIntersect(double x1, double y1, double x2, double y2, double x3,
public static boolean linesIntersect(double x1, double y1, double x2, double y2, double x3,
double y3, double x4, double y4) {
return ((relativeCCW(x1, y1, x2, y2, x3, y3) * relativeCCW(x1, y1, x2, y2, x4, y4) <= 0)
&& (relativeCCW(x3, y3, x4, y4, x1, y1)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package com.github.davidmoten.rtree.internal;

import java.awt.geom.Line2D;

public final class RectangleUtil {

private RectangleUtil() {
Expand Down Expand Up @@ -43,7 +41,7 @@ private RectangleUtil() {
public static boolean rectangleIntersectsLine(double rectX, double rectY, double rectWidth, double rectHeight,
double x1, double y1, double x2, double y2) {
return _rectangleIntersectsLine(rectX, rectY, rectWidth, rectHeight, x1, y1, x2, y2)
|| Line2D.Double.linesIntersect(rectX, rectY, rectX + rectWidth, rectY + rectHeight, x1, y1, x2, y2);
|| Line2D.linesIntersect(rectX, rectY, rectX + rectWidth, rectY + rectHeight, x1, y1, x2, y2);
}

private static boolean _rectangleIntersectsLine(double rectX, double rectY, double rectWidth,
Expand Down

0 comments on commit 527c072

Please sign in to comment.