2直線(2点指定×2)の交点座標と交角の角度の算出
Namespace: fvalgcliAssembly: fvalgcli (in fvalgcli.dll) Version: 3.1.0.0 (3.1.0.11)
Syntax
C# |
---|
public static int fnFIE_cg_calc_cross_2lineA(
DPNT_T pnt1,
DPNT_T pnt2,
DPNT_T pnt3,
DPNT_T pnt4,
ref DPNT_T cross,
ref double angle
) |
Visual Basic |
---|
Public Shared Function fnFIE_cg_calc_cross_2lineA (
pnt1 As DPNT_T,
pnt2 As DPNT_T,
pnt3 As DPNT_T,
pnt4 As DPNT_T,
ByRef cross As DPNT_T,
ByRef angle As Double
) As Integer |
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 |
---|
using System;
using System.Collections.Generic;
using System.Text;
using fvalgcli;
namespace TC
{
public partial class FIE
{
[FvPluginExecute]
public void fnFIE_cg_calc_cross_2lineA()
{
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 cross = new DPNT_T();
double angle = new double();
const double ans_angle = 41.893972904383;
pts1.x = 30;
pts1.y = 30;
pts2.x = 300;
pts2.y = 300;
pts3.x = 54;
pts3.y = 163;
pts4.x = 441;
pts4.y = 184;
status = api.fnFIE_cg_calc_cross_2lineA(pts1, pts2, pts3, pts4, ref cross, ref angle);
Assert.IsTrue(status == (int)f_err.F_ERR_NONE, "エラーが発生しました。({0})", (f_err)status);
ConsoleOut.WriteFunctionName(":\n");
Console.WriteLine("cross.x: {0}", cross.x);
Console.WriteLine("cross.y: {0}", cross.y);
Console.WriteLine("angle: {0}", angle * 180 / Math.PI);
Console.Write(" ...");
ConsoleOut.IsTrue(DblEqual(angle * 180 / Math.PI, ans_angle));
}
}
} |
Visual Basic | Copy |
---|
Imports System.Collections.Generic
Imports System.Text
Imports fvalgcli
Public Partial Class FIE
<FvPluginExecute> _
Public Sub fnFIE_cg_calc_cross_2lineA()
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 cross As New DPNT_T()
Dim angle As New Double()
Const ans_angle As Double = 41.893972904383
pts1.x = 30
pts1.y = 30
pts2.x = 300
pts2.y = 300
pts3.x = 54
pts3.y = 163
pts4.x = 441
pts4.y = 184
status = api.fnFIE_cg_calc_cross_2lineA(pts1, pts2, pts3, pts4, cross, angle)
Assert.IsTrue(status = CInt(f_err.F_ERR_NONE), "エラーが発生しました。({0})", CType(status, f_err))
ConsoleOut.WriteFunctionName(":" & vbLf)
Console.WriteLine("cross.x: {0}", cross.x)
Console.WriteLine("cross.y: {0}", cross.y)
Console.WriteLine("angle: {0}", angle * 180 / Math.PI)
Console.Write(" ...")
ConsoleOut.IsTrue(DblEqual(angle * 180 / Math.PI, ans_angle))
End Sub
End Class |
See Also