FC_CommonTangentsOfTwoCircles2D

 

FC_CommonTangentsOfTwoCircles2D - General Information

Overview

Type:

Function

Available as of:

V1.0.3.0

Versions:

Current version

Task

Calculates the common tangents of two circles in the 2-dimensional space.

Description

Calculates the common tangents of the circles i_stCircle1 and i_stCircle2. There are several options here:

oThere exists no common tangent.

oThere exists one common tangent.

oThere exist two common tangents.

oThere are three common tangents.

oThere exist four common tangents.

oThere exists an infinite number of common tangents (the circles coincide).

The following figures illustrate the various different cases.

No common tangents

G-SE-0068445.1.gif-high.gif

 

 

One common tangent

G-SE-0068446.1.gif-high.gif

 

 

Two common tangents

G-SE-0068447.1.gif-high.gif

 

 

Three common tangents

G-SE-0068448.1.gif-high.gif

 

 

Four common tangents

G-SE-0068449.1.gif-high.gif

 

 

Interface

Input

Data type

Description

i_stCircle1

ST_Circle2D

Circle 1

i_stCircle2

ST_Circle2D

Circle 2

Output

Data type

Description

q_etDiag

GD.ET_Diag

General library-independent statement on the diagnostic.

A value not equal to ET_Diag.Ok corresponds to an diagnostic message.

q_etDiagExt

ET_DiagExt

POU-specific output on the diagnostic.

q_etDiag = ET_Diag.Ok -> Status message

q_etDiag <> ET_Diag.Ok -> Diagnostic message

q_diNumberOfCommonTangents

DINT

Number of common tangents.

Possible values:

0: no common tangents

1...4: 1...4 common tangents

99: an infinite number of common tangents

q_astTouchPointsCircle1

ARRAY[1..4] OF ST_Vector2D

Contact points of the tangents on circle 1

q_astTouchPointsCircle2

ARRAY[1..4] OF ST_Vector2D

Contact points of the tangents on circle 2

Diagnostic Messages

q_etDiag

q_etDiagExt

Enumeration value

Description

OK

Ok

0

Ok

InputParameterInvalid

RadiusRangeCircle1

27

The radius of circle 1 is outside the valid range.

InputParameterInvalid

RadiusRangeCircle2

28

The radius of circle 2 is outside the valid range.

Ok

Enumeration name:

Ok

Enumeration value:

0

Description:

Ok

The tangents have been calculated successfully.

RadiusRangeCircle1

Enumeration name:

RadiusRangeCircle1

Enumeration value:

27

Description:

The radius of circle 1 is outside the valid range.

Issue

Cause

Solution

-

At the input i_stCircle1.lrRadius, a number <= 0 has been transferred.

The radius of the circle must be greater than zero.

RadiusRangeCircle2

Enumeration name:

RadiusRangeCircle2

Enumeration value:

28

Description:

The radius of circle 2 is outside the valid range.

Issue

Cause

Solution

-

At the input i_stCircle2.lrRadius, a number <= 0 has been transferred.

The radius of the circle must be greater than zero.