The misc.py module#

Summary#

get_two_circle_intersections

Get the intersection points of two circles.

intersect_interval

Find the intersection of two intervals.

Description#

Provides auxiliary math functions for PyAnsys Geometry.

Module detail#

misc.get_two_circle_intersections(x0: ansys.geometry.core.typing.Real, y0: ansys.geometry.core.typing.Real, r0: ansys.geometry.core.typing.Real, x1: ansys.geometry.core.typing.Real, y1: ansys.geometry.core.typing.Real, r1: ansys.geometry.core.typing.Real) tuple[tuple[ansys.geometry.core.typing.Real, ansys.geometry.core.typing.Real], tuple[ansys.geometry.core.typing.Real, ansys.geometry.core.typing.Real]] | None#

Get the intersection points of two circles.

Parameters:
x0Real

x coordinate of the first circle.

y0Real

y coordinate of the first circle.

r0Real

Radius of the first circle.

x1Real

x coordinate of the second circle.

y1Real

y coordinate of the second circle.

r1Real

Radius of the second circle.

Returns:
tuple[tuple[Real, Real], tuple[Real, Real]] | None

Intersection points of the two circles if they intersect. The points are returned as ((x3, y3), (x4, y4)), where (x3, y3) and (x4, y4) are the intersection points of the two circles. If the circles do not intersect, then None is returned.

Notes

This function is based on the following StackOverflow post: https://stackoverflow.com/questions/55816902/finding-the-intersection-of-two-circles

That post is based on the following implementation: https://paulbourke.net/geometry/circlesphere/

misc.intersect_interval(first_min, second_min, first_max, second_max) tuple[bool, ansys.geometry.core.typing.Real, ansys.geometry.core.typing.Real]#

Find the intersection of two intervals.

Parameters:
first_minReal

The minimum value of the first interval.

second_minReal

The minimum value of the second interval.

first_maxReal

The maximum value of the first interval.

second_maxReal

The maximum value of the second interval.

Returns:
tuple[bool, Real, Real]

Tuple with a boolean to indicate whether the intervals intersect, the minimum value of the intersection interval, and the maximum value of the intersection interval. If they do not intersect, then the boolean is False and the other values are 0.