java.lang.Object
org.jhotdraw8.geom.intersect.IntersectCircleLine
-
Method Summary
Modifier and TypeMethodDescriptionstatic IntersectionResultExintersectCircleLineEx(double cx, double cy, double r, double a0x, double a0y, double a1x, double a1y) static IntersectionResultExintersectCircleLineEx(Point2D c, double r, Point2D a0, Point2D a1) Computes the intersection between a circle and a line.static IntersectionResultintersectLineCircle(double x0, double y0, double x1, double y1, double cx, double cy, double r) static IntersectionResultintersectLineCircle(double x0, double y0, double x1, double y1, double cx, double cy, double r, double epsilon) static IntersectionResultintersectLineCircle(Point2D a0, Point2D a1, Point2D c, double r, double epsilon) static IntersectionResultExintersectLineCircleEx(double x0, double y0, double x1, double y1, double cx, double cy, double r) Computes the intersection between a line and a circle.static IntersectionResultExintersectLineCircleEx(double x0, double y0, double x1, double y1, double cx, double cy, double r, double epsilon) This method computes the argument of the circle function with atan2 and thus may be unnecessarily slow if you only need the argument of the line function.static IntersectionResultExintersectLineCircleEx(Point2D a0, Point2D a1, Point2D c, double r) Computes the intersection between a line and a circle.static IntersectionResultExintersectLineCircleEx(Point2D a0, Point2D a1, Point2D c, double r, double epsilon)
-
Method Details
-
intersectCircleLineEx
public static IntersectionResultEx intersectCircleLineEx(double cx, double cy, double r, double a0x, double a0y, double a1x, double a1y) -
intersectCircleLineEx
public static IntersectionResultEx intersectCircleLineEx(Point2D c, double r, Point2D a0, Point2D a1) Computes the intersection between a circle and a line.FIXME actually computes line intersection with parameter t of line, and not t of circle.
- Parameters:
c- the center of the circler- the radius of the circlea0- point 1 of the linea1- point 2 of the line- Returns:
- computed intersection
-
intersectLineCircleEx
public static IntersectionResultEx intersectLineCircleEx(Point2D a0, Point2D a1, Point2D c, double r) Computes the intersection between a line and a circle.The intersection will contain the parameters 't' of the line in range [0,1].
- Parameters:
a0- point 0 of the linea1- point 1 of the linec- the center of the circler- the radius of the circle- Returns:
- computed intersection
-
intersectLineCircleEx
public static IntersectionResultEx intersectLineCircleEx(Point2D a0, Point2D a1, Point2D c, double r, double epsilon) -
intersectLineCircle
public static IntersectionResult intersectLineCircle(Point2D a0, Point2D a1, Point2D c, double r, double epsilon) -
intersectLineCircleEx
public static IntersectionResultEx intersectLineCircleEx(double x0, double y0, double x1, double y1, double cx, double cy, double r) Computes the intersection between a line and a circle.The intersection will contain the parameters 't' of the line in range [0 - epsilon, 1 + epsilon].
The intersection will have one of the following status:
IntersectionStatus.INTERSECTIONIntersectionStatus.NO_INTERSECTION_INSIDEIntersectionStatus.NO_INTERSECTION_OUTSIDE
This method solves the following equation:
x0 + (x1 - x0) · t, y0 + (y1 - y0) · t, with t in range [0,1] : line equation (x - cx)² + (y - cy)² = r² : circle equation (x0 + (x1 - x0) · t - cx)² + (y0 + (y1 - y0) · t - cy)² - r² =0 : intersection equation (x0 + x1·t - x0·t - cx)² + (y0 + y1· t - y0· t - cy)² - r² =0 -2·x0·x1·t² + 2·x0·(cx+x1)·t - 2·x0*cx +(x0²+x1²)·t² - 2·(x0² - x1·cx)·t + x0² + cx² ...+same for y... - r² =0 (x0²+-2·x0·x1+x1²)·t² + (2·x0·(cx+x1)- 2·(x0² - x1·cx))·t - 2·x0*cx + x0² + cx² ...+same for y... - r² =0 (x1 - x0)²·t² + 2·((x1 - x0)·(x0 - cx))·t - 2·x0*cx + x0² + cx² ...+same for y... - r² =0 (x1 - x0)²·(y1 - y0)²·t² + 2·((x1 - x0)·(x0 - cx)+(y1 - y0)·(y0 - cy))·t - 2·(x0·cx + y0·cy) + cx² + cy² + x0² + y0² - r² =0 Δx²·Δy²·t² + 2·(Δx·(x0 - cx)+Δy·(y0 - cy))·t - 2·(x0·cx + y0·cy) + cx² + cy² + x0² + y0² - r² =0 a·t² + b·t + c = 0 : quadratic polynomial, with t in range [0,1]
- Parameters:
x0- point 0 of the liney0- point 0 of the linex1- point 1 of the liney1- point 1 of the linecx- the center of the circlecy- the center of the circler- the radius of the circle- Returns:
- computed intersection
-
intersectLineCircleEx
public static IntersectionResultEx intersectLineCircleEx(double x0, double y0, double x1, double y1, double cx, double cy, double r, double epsilon) This method computes the argument of the circle function with atan2 and thus may be unnecessarily slow if you only need the argument of the line function.- Parameters:
x0- point 0 of the liney0- point 0 of the linex1- point 1 of the liney1- point 1 of the linecx- the center of the circlecy- the center of the circler- the radius of the circleepsilon- epsilon value- Returns:
- intersection result
-
intersectLineCircle
public static IntersectionResult intersectLineCircle(double x0, double y0, double x1, double y1, double cx, double cy, double r) -
intersectLineCircle
public static IntersectionResult intersectLineCircle(double x0, double y0, double x1, double y1, double cx, double cy, double r, double epsilon)
-