tangents

fun Circle.tangents(other: Circle, isInner: Boolean = false): List<Pair<Vector2, Vector2>>(source)

Calculates the tangent lines between this circle and another circle.

Depending on the value of isInner, the method computes either the inner tangents or outer tangents between the two circles.

Return

A list of pairs of points where each pair represents a tangent line. Each pair contains one point on this circle and the corresponding point on the other circle. Returns an empty list if no valid tangent lines exist between the circles.

Parameters

other

The other circle with which to calculate tangents.

isInner

If true, computes inner tangents where the tangents go through the region between the two circles. If false (default), computes outer tangents.


fun Circle.tangents(point: Vector2): Pair<Vector2, Vector2>(source)

Computes the tangent points from a given external point to a circle.

If the circle is invalid (e.g., has an undefined radius or center), the function returns a pair of infinite vectors.

Return

A pair of Vector2 representing the two points on the circle where the tangents from the given external point touch the circle.

Parameters

point

The external point from which tangents to the circle are calculated.