UtilityEx.GetLinesTangentToTwoCircles (Circle, Circle, out Line()) Method

Computes the segments tangent to two given circles.
Public Shared Function GetLinesTangentToTwoCircles( _ 
ByVal c1 As Circle, _ 
ByVal c2 As Circle, _ 
ByRef tangentArray As Line() _ 
) As Integer
This language is not supported or no code example is available.
public static int GetLinesTangentToTwoCircles( 
Circle c1
Circle c2
out Line[] tangentArray 
)
This language is not supported or no code example is available.

Parameters

c1
Circle

The first circle.

c2
Circle

The second circle.

tangentArray
Line[]

Array of length 4 containing the tangent lines.

Return Value

int

The number of not null lines in tangentArray.

Remarks
 
For arcs, it returns the same result as for circles, for a different result use GetLinesTangentToTwoCircles. All the lines start from c1 and end on c2, except for the tangent lines that are perpendicular to the line connecting the two centers, we will refer to these tangents as vertical or VERT: their length is equal to the diameter of the bigger circle and they touch the circles at the midPoint. The position of the lines in the array is fixed and dependent from the number of solutions:
  • [0] upper external (or outer),
  • [1] lower external (or outer),
  • [2] upper internal (or inner),
  • [3] lower internal (or inner).
To define upper we use the positive direction of the Y axis of the plane with axis Z equal to c1.Plane, and axis X given by the direction c1.Center-c2.Center. Based on the number of solutions, the possibilities are:
  • 0 => [null, null, null, null]: one circle is completely inside the other and they don't intersect,
  • 1 => [null, null, null, VERT]: one circle is completely inside the other and they are tangent
  • 2 => [LINE, LINE, null, null]: the circles intersect in two different points, there are only the external tangents,
  • 3 => [LINE, LINE, VERT, null]: the circles intersect in one point, but they aren't one inside the other, there are the external tangents and a vertical tangent,
  • 4 => [LINE, LINE, LINE, LINE]: the circles don't intersect and they aren't one inside the other, there are the external tangents and the internal tangents.

.NET Framework

Supported in: 4.8

In this article

Definition