5点を通る辺を持つ四角形の中心座標

Namespace: fvalgcli
Assembly: fvalgcli (in fvalgcli.dll) Version: 3.1.0.0 (3.1.0.11)

Syntax

C#
public static int fnFIE_cg_calc_rectangle_5point(
	DPNT_T pnt1,
	DPNT_T pnt2,
	DPNT_T pnt3,
	DPNT_T pnt4,
	DPNT_T pnt5,
	ref double long_len,
	ref double short_len,
	ref DPNT_T center
)
Visual Basic
Public Shared Function fnFIE_cg_calc_rectangle_5point ( 
	pnt1 As DPNT_T,
	pnt2 As DPNT_T,
	pnt3 As DPNT_T,
	pnt4 As DPNT_T,
	pnt5 As DPNT_T,
	ByRef long_len As Double,
	ByRef short_len As Double,
	ByRef center As DPNT_T
) As Integer

Parameters

pnt1
Type: fvalgcli..::..DPNT_T
四角形の基準となる辺を作る直線Lのための点P1
pnt2
Type: fvalgcli..::..DPNT_T
四角形の基準となる辺を作る直線Lのための点P2
pnt3
Type: fvalgcli..::..DPNT_T
直線Lと隣り合う辺を作る点P3
pnt4
Type: fvalgcli..::..DPNT_T
直線Lと向かい合う辺を作る点P4
pnt5
Type: fvalgcli..::..DPNT_T
直線Lと隣り合う辺を作る点P5
long_len
Type: System..::..Double%
長方形の長辺の長さ
short_len
Type: System..::..Double%
長方形の短辺の長さ
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 imageCopy
//    $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_5point()
        {
            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 pts5 = new DPNT_T();
            DPNT_T center = new DPNT_T();
            double long_len = new double();
            double short_len = new double();

            DPNT_T ans_center = DPNT_T.init(150, 200);

            pts1.x = 100;
            pts1.y = 100;
            pts2.x = 200;
            pts2.y = 100;
            pts3.x = 250;
            pts3.y = 200;
            pts4.x = 150;
            pts4.y = 300;
            pts5.x = 50;
            pts5.y = 200;

            status = api.fnFIE_cg_calc_rectangle_5point(pts1, pts2, pts3, pts4, pts5, ref long_len, ref short_len, ref center);

            Assert.IsTrue(status == (int)f_err.F_ERR_NONE, "エラーが発生しました。({0})", (f_err)status);

            // 結果を出力する.
            ConsoleOut.WriteFunctionName(":\n");
            Console.WriteLine("5point long_len = {0}", long_len);
            Console.WriteLine("5point short_len = {0}", short_len);
            Console.WriteLine("5point center.x = {0}", center.x);
            Console.WriteLine("5point center.y = {0}", center.y);
            Console.Write(" ...");
            ConsoleOut.IsTrue(center.x == ans_center.x && center.y == ans_center.y);
        }
    }
}


Visual Basic Copy imageCopy
'    $Revision: 1.1 $

Imports System.Collections.Generic
Imports System.Text
Imports fvalgcli

Public Partial Class FIE
    <FvPluginExecute> _
    Public Sub fnFIE_cg_calc_rectangle_5point()
        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 pts5 As New DPNT_T()
        Dim center As New DPNT_T()
        Dim long_len As New Double()
        Dim short_len As New Double()

        Dim ans_center As DPNT_T = DPNT_T.init(150, 200)

        pts1.x = 100
        pts1.y = 100
        pts2.x = 200
        pts2.y = 100
        pts3.x = 250
        pts3.y = 200
        pts4.x = 150
        pts4.y = 300
        pts5.x = 50
        pts5.y = 200

        status = api.fnFIE_cg_calc_rectangle_5point(pts1, pts2, pts3, pts4, pts5, long_len, _
            short_len, center)

        Assert.IsTrue(status = CInt(f_err.F_ERR_NONE), "エラーが発生しました。({0})", CType(status, f_err))

        ' 結果を出力する.
        ConsoleOut.WriteFunctionName(":" & vbLf)
        Console.WriteLine("5point long_len = {0}", long_len)
        Console.WriteLine("5point short_len = {0}", short_len)
        Console.WriteLine("5point center.x = {0}", center.x)
        Console.WriteLine("5point center.y = {0}", center.y)
        Console.Write(" ...")
        ConsoleOut.IsTrue(center.x = ans_center.x AndAlso center.y = ans_center.y)
    End Sub
End Class

See Also