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_centerline_4point(
	DPNT_T pnt1,
	DPNT_T pnt2,
	DPNT_T pnt3,
	DPNT_T pnt4,
	ref DLINE_T line
)
Visual Basic
Public Shared Function fnFIE_cg_calc_centerline_4point ( 
	pnt1 As DPNT_T,
	pnt2 As DPNT_T,
	pnt3 As DPNT_T,
	pnt4 As DPNT_T,
	ByRef line As DLINE_T
) As Integer

Parameters

pnt1
Type: fvalgcli..::..DPNT_T
直線L1を作る座標点P1
pnt2
Type: fvalgcli..::..DPNT_T
直線L1を作る座標点P2
pnt3
Type: fvalgcli..::..DPNT_T
直線L2を作る座標点P3
pnt4
Type: fvalgcli..::..DPNT_T
直線L2を作る座標点P4
line
Type: fvalgcli..::..DLINE_T%
2直線の中心を通る直線

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_centerline_4point()
        {
            int status = (int)f_err.F_ERR_NONE;

            DPNT_T pnts1 = new DPNT_T();
            DPNT_T pnts2 = new DPNT_T();
            DPNT_T pnts3 = new DPNT_T();
            DPNT_T pnts4 = new DPNT_T();
            DLINE_T line = new DLINE_T();

            DLINE_T ans_line = DLINE_T.init(1, -1, -100);

            // 4点の座標設定.
            pnts1.x = 50;
            pnts1.y = 50;
            pnts2.x = 250;
            pnts2.y = 250;
            pnts3.x = 250;
            pnts3.y = 50;
            pnts4.x = 450;
            pnts4.y = 250;    

            status = api.fnFIE_cg_calc_centerline_4point(pnts1, pnts2, pnts3, pnts4, ref line);

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

            // 結果を出力する.
            ConsoleOut.WriteFunctionName(":\n");
            Console.WriteLine("center_line = ({0},{1},{2})", line.a, line.b, line.c);
            Console.Write(" ...");
            ConsoleOut.IsTrue(line.a == ans_line.a);
        }
    }
}


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_centerline_4point()
        Dim status As Integer = CInt(f_err.F_ERR_NONE)

        Dim pnts1 As New DPNT_T()
        Dim pnts2 As New DPNT_T()
        Dim pnts3 As New DPNT_T()
        Dim pnts4 As New DPNT_T()
        Dim line As New DLINE_T()

        Dim ans_line As DLINE_T = DLINE_T.init(1, -1, -100)

        ' 4点の座標設定.
        pnts1.x = 50
        pnts1.y = 50
        pnts2.x = 250
        pnts2.y = 250
        pnts3.x = 250
        pnts3.y = 50
        pnts4.x = 450
        pnts4.y = 250

        status = api.fnFIE_cg_calc_centerline_4point(pnts1, pnts2, pnts3, pnts4, line)

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

        ' 結果を出力する.
        ConsoleOut.WriteFunctionName(":" & vbLf)
        Console.WriteLine("center_line = ({0},{1},{2})", line.a, line.b, line.c)
        Console.Write(" ...")
        ConsoleOut.IsTrue(line.a = ans_line.a)
    End Sub
End Class

See Also