2直線の交点座標と交角の角度の算出

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_2lineC(
	DLINE_T line1,
	DLINE_T line2,
	ref DPNT_T cross,
	ref double angle
)
Visual Basic
Public Shared Function fnFIE_cg_calc_cross_2lineC ( 
	line1 As DLINE_T,
	line2 As DLINE_T,
	ByRef cross As DPNT_T,
	ByRef angle As Double
) As Integer

Parameters

line1
Type: fvalgcli..::..DLINE_T
直線L1
line2
Type: fvalgcli..::..DLINE_T
直線L2
cross
Type: fvalgcli..::..DPNT_T%
2直線の交点座標Pc
angle
Type: System..::..Double%
2直線のなす角のうち、小さい方の角度(単位:ラジアン [0, π/2] )

Return Value

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

エラーコード:
f_err内容
F_ERR_NONE正常終了
F_ERR_INVALID_PARAM 不正なパラメータが渡された
F_ERR_CALC_IMPOSSIBLE 計算不能エラー(2直線が平行で、交点が求まらない)
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_2lineC()
        {
            int status = (int)f_err.F_ERR_NONE;

            DLINE_T line1 = new DLINE_T();
            DLINE_T line2 = new DLINE_T();
            DPNT_T cross = new DPNT_T();
            double angle = new double();

            const double ans_angle = 71.56505117707;

            // 直線1の設定.
            line1.a = 1;
            line1.b = -1;
            line1.c = -100;
            // 直線2の設定.
            line2.a = 2;
            line2.b = 1;
            line2.c = -400;

            status = api.fnFIE_cg_calc_cross_2lineC(line1, line2, ref cross, ref angle);

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

            // 結果を出力する.
            ConsoleOut.WriteFunctionName(":\n");
            Console.WriteLine("2lineCcross.x: {0}", cross.x);
            Console.WriteLine("2lineCcross.y: {0}", cross.y);
            Console.WriteLine("2lineCangle: {0}", angle * 180 / Math.PI);
            Console.Write(" ...");
            ConsoleOut.IsTrue(DblEqual(angle * 180 / Math.PI, ans_angle));
        }
    }
}


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

        Dim line1 As New DLINE_T()
        Dim line2 As New DLINE_T()
        Dim cross As New DPNT_T()
        Dim angle As New Double()

        Const  ans_angle As Double = 71.56505117707

        ' 直線1の設定.
        line1.a = 1
        line1.b = -1
        line1.c = -100
        ' 直線2の設定.
        line2.a = 2
        line2.b = 1
        line2.c = -400

        status = api.fnFIE_cg_calc_cross_2lineC(line1, line2, cross, angle)

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

        ' 結果を出力する.
        ConsoleOut.WriteFunctionName(":" & vbLf)
        Console.WriteLine("2lineCcross.x: {0}", cross.x)
        Console.WriteLine("2lineCcross.y: {0}", cross.y)
        Console.WriteLine("2lineCangle: {0}", angle * 180 / Math.PI)
        Console.Write(" ...")
        ConsoleOut.IsTrue(DblEqual(angle * 180 / Math.PI, ans_angle))
    End Sub
End Class

See Also