2組の2直線の中心を通る直線の交点の検出(4直線指定)

Namespace: fvalgcli
Assembly: fvalgcli (in fvalgcli.dll) Version: 3.1.0.0 (3.1.0.11)

Syntax

C#
public static int fnFIE_cg_calc_cross_4line(
	DLINE_T line1,
	DLINE_T line2,
	DLINE_T line3,
	DLINE_T line4,
	ref DPNT_T cross
)
Visual Basic
Public Shared Function fnFIE_cg_calc_cross_4line ( 
	line1 As DLINE_T,
	line2 As DLINE_T,
	line3 As DLINE_T,
	line4 As DLINE_T,
	ByRef cross As DPNT_T
) As Integer

Parameters

line1
Type: fvalgcli..::..DLINE_T
直線L1
line2
Type: fvalgcli..::..DLINE_T
直線L2
line3
Type: fvalgcli..::..DLINE_T
直線L3
line4
Type: fvalgcli..::..DLINE_T
直線L4
cross
Type: fvalgcli..::..DPNT_T%
中心線Lc1と中心線Lc2の交点座標Pc1

Return Value

Type: Int32
以下のエラーコードを返します。

エラーコード:
f_err内容
F_ERR_NONE正常終了
F_ERR_INVALID_PARAM 不正なパラメータが渡された
F_ERR_CALC_IMPOSSIBLE 計算不能エラー
F_ERR_NO_LICENCEライセンスエラー、または未初期化エラー

Remarks

Examples

C# Copy imageCopy
//    $Revision: 1.1 $

using System;
using System.Collections.Generic;
using System.Text;
using fvalgcli;

namespace TC
{
    public partial class FIE
    {
        [FvPluginExecute]
        public void fnFIE_cg_calc_cross_4line()
        {
            int status = (int)f_err.F_ERR_NONE;

            DLINE_T line1 = new DLINE_T();
            DLINE_T line2 = new DLINE_T();
            DLINE_T line3 = new DLINE_T();
            DLINE_T line4 = new DLINE_T();
            DPNT_T cross = new DPNT_T();

            DPNT_T ans_cross = DPNT_T.init(125, 125);

            //X-Y+50=0
            line1.a = 1;
            line1.b = -1;
            line1.c = 50;

            //X-Y-50=0
            line2.a = 1;
            line2.b = -1;
            line2.c = -50;

            //X+Y-200=0
            line3.a = 1;
            line3.b = 1;
            line3.c = -200;

            //X+Y-300=0
            line4.a = 1;
            line4.b = 1;
            line4.c = -300;

            status = api.fnFIE_cg_calc_cross_4line(line1, line2, line3, line4, ref cross);

            Assert.IsTrue(status == (int)f_err.F_ERR_NONE, "エラーが発生しました。({0})", (f_err)status);

            // 結果を出力する.
            ConsoleOut.WriteFunctionName(":\n");
            Console.WriteLine("4line cross.x: {0}", cross.x);
            Console.WriteLine("4line cross.y: {0}", cross.y);
            Console.Write(" ...");
            ConsoleOut.IsTrue(cross.x == ans_cross.x && cross.y == ans_cross.y);
        }
    }
}


Visual Basic Copy imageCopy
'    $Revision: 1.1 $

Imports System.Collections.Generic
Imports System.Text
Imports fvalgcli

Public Partial Class FIE
    <FvPluginExecute> _
    Public Sub fnFIE_cg_calc_cross_4line()
        Dim status As Integer = CInt(f_err.F_ERR_NONE)

        Dim line1 As New DLINE_T()
        Dim line2 As New DLINE_T()
        Dim line3 As New DLINE_T()
        Dim line4 As New DLINE_T()
        Dim cross As New DPNT_T()

        Dim ans_cross As DPNT_T = DPNT_T.init(125, 125)

        'X-Y+50=0
        line1.a = 1
        line1.b = -1
        line1.c = 50

        'X-Y-50=0
        line2.a = 1
        line2.b = -1
        line2.c = -50

        'X+Y-200=0
        line3.a = 1
        line3.b = 1
        line3.c = -200

        'X+Y-300=0
        line4.a = 1
        line4.b = 1
        line4.c = -300

        status = api.fnFIE_cg_calc_cross_4line(line1, line2, line3, line4, cross)

        Assert.IsTrue(status = CInt(f_err.F_ERR_NONE), "エラーが発生しました。({0})", CType(status, f_err))

        ' 結果を出力する.
        ConsoleOut.WriteFunctionName(":" & vbLf)
        Console.WriteLine("4line cross.x: {0}", cross.x)
        Console.WriteLine("4line cross.y: {0}", cross.y)
        Console.Write(" ...")
        ConsoleOut.IsTrue(cross.x = ans_cross.x AndAlso cross.y = ans_cross.y)
    End Sub
End Class

See Also