FC_CommonPointOfTwoLines2D

 

FC_CommonPointOfTwoLines2D - General Information

Overview

Type:

Function

Available as of:

V1.0.3.0

Versions:

Current version

Task

Calculates the intersection of two straight lines in the 2-dimensional space.

Description

This function calculates the intersections of two straight lines in the 2-dimensional space. The function also takes into account cases of parallel or coinciding straight lines. The following parameter representation is used for the straight lines:

Line1(Parameter1) = i_stLine1.stPoint1 + Parameter1 * (i_stLine1.stPoint2 - i_stLine1.stPoint1)

Line2(Parameter2) = i_stLine2.stPoint1 + Parameter2 * (i_stLine2.stPoint2 - i_stLine2.stPoint1)

Interface

Input

Data type

Description

i_stLine1

ST_Line2D

Straight line 1

i_stLine2

ST_Line2D

Straight line 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_diNumberOfCommonPoints

DINT

Number of intersections

Possible values:

0: There is no intersection, the straight lines are parallel and do not coincide.

1: There is exactly one intersection.

99: The straight lines coincide, i.e. there is an infinite number of intersections.

q_stCommonPoint

ST_Vector2D

Intersection of the straight line, if q_diNumberOfCommonPoints = 1.

q_lrParameterLine1

LREAL

Parameter of the intersection q_stCommonPoint in the above parameter representation of the straight line 1 (only if q_diNumberOfCommonPoints = 1)

q_lrParameterLine2

LREAL

Parameter of the intersection q_stCommonPoint in the above parameter representation of the straight line 2 (only if q_diNumberOfCommonPoints = 1)

Diagnostic Messages

q_etDiag

q_etDiagExt

Enumeration value

Description

OK

Ok

0

Ok

InputParameterInvalid

DefinitionLine1

32

The definition of Line1 is not correct.

InputParameterInvalid

DefinitionLine2

33

The definition of Line2 is not correct.

DefinitionLine1

Enumeration name:

DefinitionLine1

Enumeration value:

32

Description:

The definition of Line1 is not correct.

Issue

Cause

Solution

-

At the inputs i_stLine1.stPoint1 and i_stLine1.stPoint2, the same point has been transferred.

The distance between the points stPoint1 and stPoint2 which define the straight line i_stLine1 must be at least Gc_lrZeroTolerance.

DefinitionLine2

Enumeration name:

DefinitionLine2

Enumeration value:

33

Description:

The definition of Line2 is not correct.

Issue

Cause

Solution

-

At the inputs i_stLine2.stPoint1 and i_stLine2.stPoint2, the same point has been transferred.

The distance between the points stPoint1 and stPoint2 which define the straight line i_stLine2 must be at least Gc_lrZeroTolerance.

Ok

Enumeration name:

Ok

Enumeration value:

0

Description:

Ok

The intersection has been calculated successfully.