点群を通る直線と点までの距離と中点座標の算出(点群と1点指定)
Namespace: fvalgcliAssembly: fvalgcli (in fvalgcli.dll) Version: 3.1.0.0 (3.1.0.11)
Syntax
C# |
---|
public static int fnFIE_cg_calc_center_point_and_lineB(
DPNT_T_PTR pnts,
int num,
DPNT_T pnt,
f_line_detection_mode lsm_mode,
int lsm_param,
ref DPNT_T center,
ref double dist
) |
Visual Basic |
---|
Public Shared Function fnFIE_cg_calc_center_point_and_lineB (
pnts As DPNT_T_PTR,
num As Integer,
pnt As DPNT_T,
lsm_mode As f_line_detection_mode,
lsm_param As Integer,
ByRef center As DPNT_T,
ByRef dist As Double
) As Integer |
Return Value
Type:
Int32
以下のエラーコードを返します。
エラーコード:f_err | 内容 |
---|
F_ERR_NONE | 正常終了 |
F_ERR_INVALID_PARAM | 不正なパラメータが渡された |
F_ERR_CALC_IMPOSSIBLE | 計算不能エラー |
F_ERR_NOMEMORY | メモリ不足 |
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_center_point_and_lineB()
{
int status = (int)f_err.F_ERR_NONE;
DPNT_T_PTR pnt1 = DPNT_T_PTR.Zero;
DPNT_T pnt2 = new DPNT_T();
DPNT_T center = new DPNT_T();
double dist = new double();
int num = 20;
f_line_detection_mode lsm_mode = f_line_detection_mode.F_LINE_DIRECT_NORMAL;
int lsm_param = 0;
const double ans_dist = 169.70562748477;
try
{
pnt1 = DPNT_T_PTR.alloc(num);
for (int i = 0; i < num; i++)
{
pnt1[i] = DPNT_T.init(50 * i + 50,50 * i);
}
pnt2.x = 10;
pnt2.y = 200;
status = api.fnFIE_cg_calc_center_point_and_lineB(pnt1, num, pnt2, lsm_mode, lsm_param, ref center, ref dist);
Assert.IsTrue(status == (int)f_err.F_ERR_NONE, "エラーが発生しました。({0})", (f_err)status);
ConsoleOut.WriteFunctionName(":\n");
Console.WriteLine("center = ({0},{1}), dist = {2}", center.x, center.y, dist);
Console.Write(" ...");
ConsoleOut.IsTrue(DblEqual(dist, ans_dist));
}
finally
{
pnt1.Dispose();
}
}
}
} |
Visual Basic | Copy |
---|
Imports System.Collections.Generic
Imports System.Text
Imports fvalgcli
Public Partial Class FIE
<FvPluginExecute> _
Public Sub fnFIE_cg_calc_center_point_and_lineB()
Dim status As Integer = CInt(f_err.F_ERR_NONE)
Dim pnt1 As DPNT_T_PTR = DPNT_T_PTR.Zero
Dim pnt2 As New DPNT_T()
Dim center As New DPNT_T()
Dim dist As New Double()
Dim num As Integer = 20
Dim lsm_mode As f_line_detection_mode = f_line_detection_mode.F_LINE_DIRECT_NORMAL
Dim lsm_param As Integer = 0
Const ans_dist As Double = 169.70562748477
Try
pnt1 = DPNT_T_PTR.alloc(num)
For i As Integer = 0 To num - 1
pnt1(i) = DPNT_T.init(50 * i + 50, 50 * i)
Next
pnt2.x = 10
pnt2.y = 200
status = api.fnFIE_cg_calc_center_point_and_lineB(pnt1, num, pnt2, lsm_mode, lsm_param, center, _
dist)
Assert.IsTrue(status = CInt(f_err.F_ERR_NONE), "エラーが発生しました。({0})", CType(status, f_err))
ConsoleOut.WriteFunctionName(":" & vbLf)
Console.WriteLine("center = ({0},{1}), dist = {2}", center.x, center.y, dist)
Console.Write(" ...")
ConsoleOut.IsTrue(DblEqual(dist, ans_dist))
Finally
pnt1.Dispose()
End Try
End Sub
End Class |
See Also