多角形の単純性のチェック(整数型)

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

Syntax

C#
public static int fnFIE_cg_simple_polygon_check(
	PNT_T_PTR vrtx,
	int num,
	ref int simple_type
)
Visual Basic
Public Shared Function fnFIE_cg_simple_polygon_check ( 
	vrtx As PNT_T_PTR,
	num As Integer,
	ByRef simple_type As Integer
) As Integer

Parameters

vrtx
Type: fvalgcli..::..PNT_T_PTR
多角形の頂点
num
Type: System..::..Int32
頂点数( vrtx の要素数)
simple_type
Type: System..::..Int32%
多角形の凸形状
  • 0 多角形は単純ではない
  • 1 多角形は単純である

Return Value

Type: Int32
以下のエラーコードを返します。

エラーコード:
f_err内容
F_ERR_NONE正常終了
F_ERR_INVALID_PARAM 不正なパラメータが渡された 頂点数が3未満
F_ERR_NOMEMORYメモリ不足
F_ERR_NO_LICENCEライセンスエラー、または未初期化エラー

Remarks

Examples

C# Copy imageCopy
//    $Revision: 1.1 $

//#define NOT_SIMPLE

using System;
using System.Collections.Generic;
using System.Text;

using fvalgcli;

namespace TC
{
    public partial class FIE
    {
        [FvPluginExecute]
        public void fnFIE_cg_simple_polygon_check()
        {
            int status = (int)f_err.F_ERR_NONE;

            PNT_T_PTR vrtx = PNT_T_PTR.Zero;    // 多角形の頂点 
            int num;                            // 頂点数( vrtx の要素数)
            int simple_type = 2;                // 多角形の凸形状 (0: 多角形は単純ではない、1: 単純である)
            const int size = 16;

            try
            {
                // 多角形の頂点列を確保、設定する.
                int ans_simple_type = new int();

                vrtx = PNT_T_PTR.alloc(5);

                vrtx[0] = PNT_T.init(0, 0);
                vrtx[1] = PNT_T.init(0, size);
                vrtx[2] = PNT_T.init(size, size);
                vrtx[3] = PNT_T.init(size, 0);
                vrtx[4] = PNT_T.init(size / 2, size * 2);

#if NOT_SIMPLE
                // 多角形は単純ではない.
                num = 5;
                ans_simple_type = 0;
#else
                // 多角形は単純である.
                num = 4;
                ans_simple_type = 1;
#endif
                // 多角形の単純性のチェック(整数型).
                status = api.fnFIE_cg_simple_polygon_check(vrtx, num, ref simple_type);

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

                // 結果を出力する.
                ConsoleOut.WriteFunctionName(":\t");
                Console.Write("simple_type = {0} ...", simple_type);
                ConsoleOut.IsTrue(ans_simple_type == simple_type);
            }
            finally
            {
                vrtx.Dispose();
            }
        }
    }
}


Visual Basic Copy imageCopy
'    $Revision: 1.1 $

'#Const NOT_SIMPLE = True

Imports System.Collections.Generic
Imports System.Text

Imports fvalgcli

Public Partial Class FIE
    <FvPluginExecute> _
    Public Sub fnFIE_cg_simple_polygon_check()
        Dim status As Integer = CInt(f_err.F_ERR_NONE)

        Dim vrtx As PNT_T_PTR = PNT_T_PTR.Zero
        ' 多角形の頂点 
        Dim num As Integer
        ' 頂点数( vrtx の要素数)
        Dim simple_type As Integer = 2
        ' 多角形の凸形状 (0: 多角形は単純ではない、1: 単純である)
        Const  size As Integer = 16

        Try
            ' 多角形の頂点列を確保、設定する.
            Dim ans_simple_type As New Integer()

            vrtx = PNT_T_PTR.alloc(5)

            vrtx(0) = PNT_T.init(0, 0)
            vrtx(1) = PNT_T.init(0, size)
            vrtx(2) = PNT_T.init(size, size)
            vrtx(3) = PNT_T.init(size, 0)
            vrtx(4) = PNT_T.init(size \ 2, size * 2)

            #If NOT_SIMPLE Then
            ' 多角形は単純ではない.
            num = 5
            ans_simple_type = 0
            #Else
            ' 多角形は単純である.
            num = 4
            ans_simple_type = 1
            #End If
            ' 多角形の単純性のチェック(整数型).
            status = api.fnFIE_cg_simple_polygon_check(vrtx, num, simple_type)

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

            ' 結果を出力する.
            ConsoleOut.WriteFunctionName(":" & vbTab)
            Console.Write("simple_type = {0} ...", simple_type)
            ConsoleOut.IsTrue(ans_simple_type = simple_type)
        Finally
            vrtx.Dispose()
        End Try
    End Sub
End Class

See Also