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

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_8point(
	DPNT_T pnt1,
	DPNT_T pnt2,
	DPNT_T pnt3,
	DPNT_T pnt4,
	DPNT_T pnt5,
	DPNT_T pnt6,
	DPNT_T pnt7,
	DPNT_T pnt8,
	ref DPNT_T cross
)
Visual Basic
Public Shared Function fnFIE_cg_calc_cross_8point ( 
	pnt1 As DPNT_T,
	pnt2 As DPNT_T,
	pnt3 As DPNT_T,
	pnt4 As DPNT_T,
	pnt5 As DPNT_T,
	pnt6 As DPNT_T,
	pnt7 As DPNT_T,
	pnt8 As DPNT_T,
	ByRef cross As DPNT_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
pnt5
Type: fvalgcli..::..DPNT_T
直線L3を設定する座標点P5
pnt6
Type: fvalgcli..::..DPNT_T
直線L3を設定する座標点P6
pnt7
Type: fvalgcli..::..DPNT_T
直線L4を設定する座標点P7
pnt8
Type: fvalgcli..::..DPNT_T
直線L4を設定する座標点P8
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_8point()
        {
            int status = (int)f_err.F_ERR_NONE;

            DPNT_T pts1 = new DPNT_T();
            DPNT_T pts2 = new DPNT_T();
            DPNT_T pts3 = new DPNT_T();
            DPNT_T pts4 = new DPNT_T();
            DPNT_T pts5 = new DPNT_T();
            DPNT_T pts6 = new DPNT_T();
            DPNT_T pts7 = new DPNT_T();
            DPNT_T pts8 = new DPNT_T();
            DPNT_T cross = new DPNT_T();

            DPNT_T ans_cross = DPNT_T.init(225, 175);

            // 直線1を構成する座標を設定.
            pts1.x = 50;
            pts1.y = 150;
            pts2.x = 150;
            pts2.y = 200;
            // 直線2を構成する座標を設定.
            pts3.x = 100;
            pts3.y = 50;
            pts4.x = 200;
            pts4.y = 100;
            // 直線3を構成する座標を設定.
            pts5.x = 300;
            pts5.y = 200;
            pts6.x = 400;
            pts6.y = 150;
            // 直線4を構成する座標を設定.
            pts7.x = 250;
            pts7.y = 100;
            pts8.x = 350;
            pts8.y = 50;

            status = api.fnFIE_cg_calc_cross_8point(pts1, pts2, pts3, pts4, pts5, pts6, pts7, pts8, ref cross);

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

            // 結果を出力する.
            ConsoleOut.WriteFunctionName(":\n");
            Console.WriteLine("8npoint cross.x: {0}", cross.x);
            Console.WriteLine("8npoint 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_8point()
        Dim status As Integer = CInt(f_err.F_ERR_NONE)

        Dim pts1 As New DPNT_T()
        Dim pts2 As New DPNT_T()
        Dim pts3 As New DPNT_T()
        Dim pts4 As New DPNT_T()
        Dim pts5 As New DPNT_T()
        Dim pts6 As New DPNT_T()
        Dim pts7 As New DPNT_T()
        Dim pts8 As New DPNT_T()
        Dim cross As New DPNT_T()

        Dim ans_cross As DPNT_T = DPNT_T.init(225, 175)

        ' 直線1を構成する座標を設定.
        pts1.x = 50
        pts1.y = 150
        pts2.x = 150
        pts2.y = 200
        ' 直線2を構成する座標を設定.
        pts3.x = 100
        pts3.y = 50
        pts4.x = 200
        pts4.y = 100
        ' 直線3を構成する座標を設定.
        pts5.x = 300
        pts5.y = 200
        pts6.x = 400
        pts6.y = 150
        ' 直線4を構成する座標を設定.
        pts7.x = 250
        pts7.y = 100
        pts8.x = 350
        pts8.y = 50

        status = api.fnFIE_cg_calc_cross_8point(pts1, pts2, pts3, pts4, pts5, pts6, _
            pts7, pts8, cross)

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

        ' 結果を出力する.
        ConsoleOut.WriteFunctionName(":" & vbLf)
        Console.WriteLine("8npoint cross.x: {0}", cross.x)
        Console.WriteLine("8npoint 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