KekLib.CircleGeometry#

CircleGeometry.py

circle_intersect(x0, y0, r0, x1, y1, r1)#
circle_line_segment_intersection(circle_center, circle_radius, pt1, pt2, full_line=True, tangent_tol=1e-09)#

Find the points at which a circle intersects a line-segment. This can happen at 0, 1, or 2 points.

Parameters:
  • circle_center – The (x, y) location of the circle center

  • circle_radius – The radius of the circle

  • pt1 – The (x, y) location of the first point of the segment

  • pt2 – The (x, y) location of the second point of the segment

  • full_line – True to find intersections along full line - not just in the segment. False will just return intersections within the segment.

  • tangent_tol – Numerical tolerance at which we decide the intersections are close enough to consider it a tangent

Return Sequence[Tuple[float, float]]:

A list of length 0, 1, or 2, where each element is a point at which the circle intercepts a line segment.

Note: We follow: http://mathworld.wolfram.com/Circle-LineIntersection.html

get_intersections(x0, y0, r0, x1, y1, r1)#