2組の2直線の中心を通る直線の交点の算出(4点群指定)
Namespace: fvalgcliAssembly: fvalgcli (in fvalgcli.dll) Version: 3.1.0.0 (3.1.0.11)
Syntax
C# |
---|
public static int fnFIE_cg_calc_cross_4npoint( DPNT_T_PTR pnts1, int num1, DPNT_T_PTR pnts2, int num2, DPNT_T_PTR pnts3, int num3, DPNT_T_PTR pnts4, int num4, f_line_detection_mode lsm_mode, int lsm_param, ref DPNT_T cross ) |
Visual Basic |
---|
Public Shared Function fnFIE_cg_calc_cross_4npoint ( pnts1 As DPNT_T_PTR, num1 As Integer, pnts2 As DPNT_T_PTR, num2 As Integer, pnts3 As DPNT_T_PTR, num3 As Integer, pnts4 As DPNT_T_PTR, num4 As Integer, lsm_mode As f_line_detection_mode, lsm_param As Integer, ByRef cross As DPNT_T ) As Integer |
Parameters
- pnts1
- Type: fvalgcli..::..DPNT_T_PTR
直線L1を生成する座標点群G1
- num1
- Type: System..::..Int32
点群 pnts1 に入っている点の数(2〜1000)
- pnts2
- Type: fvalgcli..::..DPNT_T_PTR
直線L2を生成する座標点群G2
- num2
- Type: System..::..Int32
点群 pnts2 に入っている点の数(2〜1000)
- pnts3
- Type: fvalgcli..::..DPNT_T_PTR
直線L3を生成する座標点群G3
- num3
- Type: System..::..Int32
点群 pnts3 に入っている点の数(2〜1000)
- pnts4
- Type: fvalgcli..::..DPNT_T_PTR
直線L4を生成する座標点群G4
- num4
- Type: System..::..Int32
点群 pnts4 に入っている点の数(2〜1000)
- lsm_mode
- Type: fvalgcli..::..f_line_detection_mode
直線生成のモード- F_LINE_DIRECT_NORMAL 通常直線検出モード
- F_LINE_DIRECT_NUM 回数指定モード
- F_LINE_DIRECT_DIST_A 距離指定モード1
- F_LINE_DIRECT_DIST_B 距離指定モード2
- lsm_param
- Type: System..::..Int32
直線生成のパラメータ
- 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_NOMEMORY | メモリ不足 |
F_ERR_NO_LICENCE | ライセンスエラー、または未初期化エラー |
Remarks
Examples
C# | Copy |
---|---|
// $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_4npoint() { int status = (int)f_err.F_ERR_NONE; DPNT_T_PTR pts1 = DPNT_T_PTR.Zero; DPNT_T_PTR pts2 = DPNT_T_PTR.Zero; DPNT_T_PTR pts3 = DPNT_T_PTR.Zero; DPNT_T_PTR pts4 = DPNT_T_PTR.Zero; DPNT_T cross = new DPNT_T(); int num = 20; f_line_detection_mode lsm_mode = f_line_detection_mode.F_LINE_DIRECT_NORMAL; int lsm_param = 0; DPNT_T ans_cross = DPNT_T.init(200, 150); try { pts1 = DPNT_T_PTR.alloc(num); pts2 = DPNT_T_PTR.alloc(num); pts3 = DPNT_T_PTR.alloc(num); pts4 = DPNT_T_PTR.alloc(num); for (int i = 0; i < num; i++) { // X=Y+80, y=0,20......380 pts1[i] = DPNT_T.init(20 * i + 80, 20 * i); // X=Y+20, y=0,20......380 pts2[i] = DPNT_T.init(20 * i + 20, 20 * i); // X=400-y, y=0,20......380 pts3[i] = DPNT_T.init(-20 * i + 400, 20 * i); // X=300-y, y=0,20......380 pts4[i] = DPNT_T.init(-20 * i + 300, 20 * i); } status = api.fnFIE_cg_calc_cross_4npoint(pts1, num, pts2, num, pts3, num, pts4, num, lsm_mode, lsm_param, ref cross); Assert.IsTrue(status == (int)f_err.F_ERR_NONE, "エラーが発生しました。({0})", (f_err)status); // 結果を出力する. ConsoleOut.WriteFunctionName(":\n"); Console.WriteLine("4npoint cross.x: {0}", cross.x); Console.WriteLine("4npoint cross.y: {0}", cross.y); Console.Write(" ..."); ConsoleOut.IsTrue(cross.x == ans_cross.x && cross.y == ans_cross.y); } finally { pts1.Dispose(); pts2.Dispose(); pts3.Dispose(); pts4.Dispose(); } } } } |
Visual Basic | Copy |
---|---|
' $Revision: 1.1 $ Imports System.Collections.Generic Imports System.Text Imports fvalgcli Public Partial Class FIE <FvPluginExecute> _ Public Sub fnFIE_cg_calc_cross_4npoint() Dim status As Integer = CInt(f_err.F_ERR_NONE) Dim pts1 As DPNT_T_PTR = DPNT_T_PTR.Zero Dim pts2 As DPNT_T_PTR = DPNT_T_PTR.Zero Dim pts3 As DPNT_T_PTR = DPNT_T_PTR.Zero Dim pts4 As DPNT_T_PTR = DPNT_T_PTR.Zero Dim cross As New DPNT_T() 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 Dim ans_cross As DPNT_T = DPNT_T.init(200, 150) Try pts1 = DPNT_T_PTR.alloc(num) pts2 = DPNT_T_PTR.alloc(num) pts3 = DPNT_T_PTR.alloc(num) pts4 = DPNT_T_PTR.alloc(num) For i As Integer = 0 To num - 1 ' X=Y+80, y=0,20......380 pts1(i) = DPNT_T.init(20 * i + 80, 20 * i) ' X=Y+20, y=0,20......380 pts2(i) = DPNT_T.init(20 * i + 20, 20 * i) ' X=400-y, y=0,20......380 pts3(i) = DPNT_T.init(-20 * i + 400, 20 * i) ' X=300-y, y=0,20......380 pts4(i) = DPNT_T.init(-20 * i + 300, 20 * i) Next status = api.fnFIE_cg_calc_cross_4npoint(pts1, num, pts2, num, pts3, num, _ pts4, num, lsm_mode, lsm_param, cross) Assert.IsTrue(status = CInt(f_err.F_ERR_NONE), "エラーが発生しました。({0})", CType(status, f_err)) ' 結果を出力する. ConsoleOut.WriteFunctionName(":" & vbLf) Console.WriteLine("4npoint cross.x: {0}", cross.x) Console.WriteLine("4npoint cross.y: {0}", cross.y) Console.Write(" ...") ConsoleOut.IsTrue(cross.x = ans_cross.x AndAlso cross.y = ans_cross.y) Finally pts1.Dispose() pts2.Dispose() pts3.Dispose() pts4.Dispose() End Try End Sub End Class |