点群を通る円と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_circle_and_lineA( DPNT_T_PTR pnts, int num, DPNT_T pnt1, DPNT_T pnt2, ref int cross_num, ref DPNT_T cross1, ref DPNT_T cross2 ) |
Visual Basic |
---|
Public Shared Function fnFIE_cg_calc_cross_circle_and_lineA ( pnts As DPNT_T_PTR, num As Integer, pnt1 As DPNT_T, pnt2 As DPNT_T, ByRef cross_num As Integer, ByRef cross1 As DPNT_T, ByRef cross2 As DPNT_T ) As Integer |
Parameters
- pnts
- Type: fvalgcli..::..DPNT_T_PTR
円を生成する座標点群G1。 num 個の点が必要
- num
- Type: System..::..Int32
点群の点数(3〜16個)
- pnt1
- Type: fvalgcli..::..DPNT_T
直線を構成する座標点P1
- pnt2
- Type: fvalgcli..::..DPNT_T
直線を構成する座標点P2
- cross_num
- Type: System..::..Int32%
交点数
- cross1
- Type: fvalgcli..::..DPNT_T%
交点座標Pi1
- cross2
- Type: fvalgcli..::..DPNT_T%
交点座標Pi2
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 |
---|---|
// $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_circle_and_lineA() { int status = (int)f_err.F_ERR_NONE; DPNT_T_PTR pts = DPNT_T_PTR.Zero; DPNT_T pts1 = new DPNT_T(); DPNT_T pts2 = new DPNT_T(); DPNT_T cross1 = new DPNT_T(); DPNT_T cross2 = new DPNT_T(); int cross_num = 0; int num = 16; const int ans_num = 2; try { pts = DPNT_T_PTR.alloc(num); pts1.x = 10; pts1.y = 10; pts2.x = 400; pts2.y = 400; for (int i = 0; i < num / 2; i++) { //点列の半分(0~7). pts[i] = DPNT_T.init(250 + (int)Math.Sqrt(10000 - (150 + 25 * i - 250) * (150 + 25 * i - 250)), 150 + 25 * i); //点列の半分(8~15). pts[i + (num / 2)] = DPNT_T.init(250 - (int)Math.Sqrt(10000 - (150 + 25 * i - 250) * (150 + 25 * i - 250)), 150 + 25 * i); // circle:(X-250)(X-250)+(Y-250)(Y-250)=100*100, Y=150,175......325 } status = api.fnFIE_cg_calc_cross_circle_and_lineA(pts, num, pts1, pts2, ref cross_num, ref cross1, ref cross2); Assert.IsTrue(status == (int)f_err.F_ERR_NONE, "エラーが発生しました。({0})", (f_err)status); // 結果を出力する. ConsoleOut.WriteFunctionName(":\n"); Console.WriteLine("cross_num: {0}", cross_num); Console.WriteLine("cross1.x: {0}", cross1.x); Console.WriteLine("cross1.y: {0}", cross1.y); Console.WriteLine("cross2.x: {0}", cross2.x); Console.WriteLine("cross2.y: {0}", cross2.y); Console.Write(" ..."); ConsoleOut.IsTrue(cross_num == ans_num); } finally { pts.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_circle_and_lineA() Dim status As Integer = CInt(f_err.F_ERR_NONE) Dim pts As DPNT_T_PTR = DPNT_T_PTR.Zero Dim pts1 As New DPNT_T() Dim pts2 As New DPNT_T() Dim cross1 As New DPNT_T() Dim cross2 As New DPNT_T() Dim cross_num As Integer = 0 Dim num As Integer = 16 Const ans_num As Integer = 2 Try pts = DPNT_T_PTR.alloc(num) pts1.x = 10 pts1.y = 10 pts2.x = 400 pts2.y = 400 For i As Integer = 0 To num \ 2 - 1 '点列の半分(0~7). pts(i) = DPNT_T.init(250 + CInt(Math.Truncate(Math.Sqrt(10000 - (150 + 25 * i - 250) * (150 + 25 * i - 250)))), 150 + 25 * i) '点列の半分(8~15). ' circle:(X-250)(X-250)+(Y-250)(Y-250)=100*100, Y=150,175......325 pts(i + (num \ 2)) = DPNT_T.init(250 - CInt(Math.Truncate(Math.Sqrt(10000 - (150 + 25 * i - 250) * (150 + 25 * i - 250)))), 150 + 25 * i) Next status = api.fnFIE_cg_calc_cross_circle_and_lineA(pts, num, pts1, pts2, cross_num, cross1, _ cross2) Assert.IsTrue(status = CInt(f_err.F_ERR_NONE), "エラーが発生しました。({0})", CType(status, f_err)) ' 結果を出力する. ConsoleOut.WriteFunctionName(":" & vbLf) Console.WriteLine("cross_num: {0}", cross_num) Console.WriteLine("cross1.x: {0}", cross1.x) Console.WriteLine("cross1.y: {0}", cross1.y) Console.WriteLine("cross2.x: {0}", cross2.x) Console.WriteLine("cross2.y: {0}", cross2.y) Console.Write(" ...") ConsoleOut.IsTrue(cross_num = ans_num) Finally pts.Dispose() End Try End Sub End Class |