四角形の中心座標の算出(4直線指定)
Namespace: fvalgcliAssembly: fvalgcli (in fvalgcli.dll) Version: 3.1.0.0 (3.1.0.11)
Syntax
C# |
---|
public static int fnFIE_cg_calc_rectangle_4line( DLINE_T lineAB, DLINE_T lineBC, DLINE_T lineCD, DLINE_T lineDA, ref double long1, ref double short1, ref double long2, ref double short2, ref DPNT_T center ) |
Visual Basic |
---|
Public Shared Function fnFIE_cg_calc_rectangle_4line ( lineAB As DLINE_T, lineBC As DLINE_T, lineCD As DLINE_T, lineDA As DLINE_T, ByRef long1 As Double, ByRef short1 As Double, ByRef long2 As Double, ByRef short2 As Double, ByRef center As DPNT_T ) As Integer |
Parameters
- lineAB
- Type: fvalgcli..::..DLINE_T
辺AB
- lineBC
- Type: fvalgcli..::..DLINE_T
辺BC
- lineCD
- Type: fvalgcli..::..DLINE_T
辺CD
- lineDA
- Type: fvalgcli..::..DLINE_T
辺DA
- long1
- Type: System..::..Double%
長辺1の長さ
- short1
- Type: System..::..Double%
短辺1の長さ
- long2
- Type: System..::..Double%
長辺2の長さ
- short2
- Type: System..::..Double%
短辺2の長さ
- center
- Type: fvalgcli..::..DPNT_T%
中心点座標
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_rectangle_4line() { int status = (int)f_err.F_ERR_NONE; DLINE_T lineAB = new DLINE_T(); DLINE_T lineBC = new DLINE_T(); DLINE_T lineCD = new DLINE_T(); DLINE_T lineDA = new DLINE_T(); DPNT_T center = new DPNT_T(); double long_len1 = new double(); double long_len2 = new double(); double short_len1 = new double(); double short_len2 = new double(); DPNT_T ans_center = DPNT_T.init(250, 250); // X-Y+100=0 lineAB.a = 1; lineAB.b = -1; lineAB.c = 100; // X+Y-100=0 lineBC.a = 1; lineBC.b = 1; lineBC.c = -100; // X-Y-100=0 lineCD.a = 1; lineCD.b = -1; lineCD.c = -100; // X+Y-900=0 lineDA.a = 1; lineDA.b = 1; lineDA.c = -900; status = api.fnFIE_cg_calc_rectangle_4line(lineAB, lineBC, lineCD, lineDA, ref long_len1, ref short_len1, ref long_len2, ref short_len2, ref center); Assert.IsTrue(status == (int)f_err.F_ERR_NONE, "エラーが発生しました。({0})", (f_err)status); // 結果を出力する. ConsoleOut.WriteFunctionName(":\n"); Console.WriteLine("long_len1 = {0}", long_len1); Console.WriteLine("short_len1 = {0}", short_len1); Console.WriteLine("long_len2 = {0}", long_len2); Console.WriteLine("short_len2 = {0}", short_len2); Console.WriteLine("center.x = {0}", center.x); Console.WriteLine("center.y = {0}", center.y); Console.Write(" ..."); ConsoleOut.IsTrue(center.x == ans_center.x && center.y == ans_center.y); } } } |
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_rectangle_4line() Dim status As Integer = CInt(f_err.F_ERR_NONE) Dim lineAB As New DLINE_T() Dim lineBC As New DLINE_T() Dim lineCD As New DLINE_T() Dim lineDA As New DLINE_T() Dim center As New DPNT_T() Dim long_len1 As New Double() Dim long_len2 As New Double() Dim short_len1 As New Double() Dim short_len2 As New Double() Dim ans_center As DPNT_T = DPNT_T.init(250, 250) ' X-Y+100=0 lineAB.a = 1 lineAB.b = -1 lineAB.c = 100 ' X+Y-100=0 lineBC.a = 1 lineBC.b = 1 lineBC.c = -100 ' X-Y-100=0 lineCD.a = 1 lineCD.b = -1 lineCD.c = -100 ' X+Y-900=0 lineDA.a = 1 lineDA.b = 1 lineDA.c = -900 status = api.fnFIE_cg_calc_rectangle_4line(lineAB, lineBC, lineCD, lineDA, long_len1, short_len1, _ long_len2, short_len2, center) Assert.IsTrue(status = CInt(f_err.F_ERR_NONE), "エラーが発生しました。({0})", CType(status, f_err)) ' 結果を出力する. ConsoleOut.WriteFunctionName(":" & vbLf) Console.WriteLine("long_len1 = {0}", long_len1) Console.WriteLine("short_len1 = {0}", short_len1) Console.WriteLine("long_len2 = {0}", long_len2) Console.WriteLine("short_len2 = {0}", short_len2) Console.WriteLine("center.x = {0}", center.x) Console.WriteLine("center.y = {0}", center.y) Console.Write(" ...") ConsoleOut.IsTrue(center.x = ans_center.x AndAlso center.y = ans_center.y) End Sub End Class |