4MELFA-BASIC IV
Detailed Explanation of Functions
4-312
CalArc
[Function]
Provides information regarding the arc that contains the three specified points.
[Format]
[Terminology]
<Position 1>
Specifies the starting point of the arc.
<Position 2>
Specifies the passing point of the arc. Same as the three points in the Mvr instruction.
<Position 3>
Specifies the endpoint of the arc.
<Numeric Variable 1>
Radius of the specified arc (in mm) will be calculated and returned.
<Numeric Variable 2>
Central angle of the specified arc (in radians) will be calculated and returned.
<Numeric Variable 3>
Length of the specified arc (in mm) will be calculated and returned.
<Position Variables 1>
The center coordinates of the specified arc (in mm) will be calculated and returned (as a position data
type, ABC are all zeros).
<Numeric Variable 4>
Return value
1 : Calculation was performed normally.
-1 : Of positions 1, 2, and 3, either two points had the exact same position or all three points were on
a straight line.
-2 : All three points are at approximately the same position.
[Reference Program]
1 M1=CalArc(P1,P2,P3,M10,M20,M30,P10)
2 If M1<>1 Then End
' Ends if an error occurs.
3 MR=M10
' Radius.
4 MRD=M20
' Circular arc angle.
5 MARCLEN=M30
' Circular arc length.
6 PC=P10
' Coordinates of the center point.
[Explanation]
(1) Provides information regarding the arc that is determined by the three specified points, position 1, posi-
tion 2 and position 3.
(2) If the arc generation and calculation of various values succeeded, 1 will be returned as the return value.
(3) If some points have the exact same position or if all three points are on a straight line, -1 will be returned
as the return value. In such cases, the distance between the starting point and the endpoint will be
returned as the arc length, -1 as the radius, 0 as the central angle, and (0, 0, 0) as the center point.
(4) If circular arc generation fails, -2 will be returned as the return value. If a circular arc cannot be gener-
ated, -1, 0, 0 and (0, 0, 0) are returned as the radius, central angle, arc length and center point, respec-
tively.
(5) It is not possible to describe a function that contains an argument in <position 1>, <position 2>, <position
3>, <numeric variable 1>, <numerical variable 2>, <numeric variable 3> and <position variable 1>. If
such a function is described, an error will be generated during execution.
<Numeric Variable 4> = CalArc(<Position 1>, <Position 2>, <Position 3>,
<Numeric Variable 1>, <Numeric Variable 2>, <Numeric Variable 3>,
<Position Variables 1>)