点の単純多角形に対する位置判定
Namespace: fvalgcliAssembly: fvalgcli (in fvalgcli.dll) Version: 3.1.0.0 (3.1.0.11)
Syntax
C# |
---|
public static int fnFIE_cg_pos_point_to_simple_polygon(
PNT_T pnt,
PNT_T_PTR vrtx,
int num,
ref f_cg_pnt_pos pos
) |
Visual Basic |
---|
Public Shared Function fnFIE_cg_pos_point_to_simple_polygon (
pnt As PNT_T,
vrtx As PNT_T_PTR,
num As Integer,
ByRef pos As f_cg_pnt_pos
) As Integer |
Return Value
Type:
Int32
以下のエラーコードを返します。
エラーコード:f_err | 内容 |
---|
F_ERR_NONE | 正常終了 |
F_ERR_INVALID_PARAM | 不正なパラメータが渡された(頂点数が3未満) |
F_ERR_NOMEMORY | メモリ不足 |
F_ERR_CALC_IMPOSSIBLE | 頂点列が凸多角形ではないため、計算不能(頂点数が3以上の場合) |
F_ERR_NO_LICENCE | ライセンスエラー、または未初期化エラー |
Remarks
Examples
C# | Copy |
---|
#define PNT_INNER
using System;
using System.Collections.Generic;
using System.Text;
using fvalgcli;
namespace TC
{
public partial class FIE
{
[FvPluginExecute]
public void fnFIE_cg_pos_point_to_simple_polygon()
{
int status = (int)f_err.F_ERR_NONE;
PNT_T pnt;
PNT_T_PTR vrtx = PNT_T_PTR.Zero;
int num;
f_cg_pnt_pos pos = new f_cg_pnt_pos();
const int size = 32;
try
{
num = 4;
vrtx = PNT_T_PTR.alloc(num);
vrtx[0] = PNT_T.init(0, 0);
vrtx[1] = PNT_T.init(size, 0);
vrtx[2] = PNT_T.init(size, size);
vrtx[3] = PNT_T.init(0, size);
f_cg_pnt_pos ans_pos;
#if PNT_INNER
pnt.x = size / 2;
pnt.y = size / 2;
ans_pos = f_cg_pnt_pos.F_CG_INNER_PNT;
#else
pnt.x = size * 2;
pnt.y = size * 2;
ans_pos = f_cg_pnt_pos.F_CG_OUTER_PNT;
#endif
status = api.fnFIE_cg_pos_point_to_simple_polygon(pnt, vrtx, num, ref pos);
Assert.IsTrue(status == (int)f_err.F_ERR_NONE, "エラーが発生しました。({0})", (f_err)status);
ConsoleOut.WriteFunctionName(": \t");
Console.Write("pos = {0} ...", pos);
ConsoleOut.IsTrue(pos == ans_pos);
}
finally
{
vrtx.Dispose();
}
}
}
} |
Visual Basic | Copy |
---|
#Const PNT_INNER = True
Imports System.Collections.Generic
Imports System.Text
Imports fvalgcli
Public Partial Class FIE
<FvPluginExecute> _
Public Sub fnFIE_cg_pos_point_to_simple_polygon()
Dim status As Integer = CInt(f_err.F_ERR_NONE)
Dim pnt As PNT_T
Dim vrtx As PNT_T_PTR = PNT_T_PTR.Zero
Dim num As Integer
Dim pos As New f_cg_pnt_pos()
Const size As Integer = 32
Try
num = 4
vrtx = PNT_T_PTR.alloc(num)
vrtx(0) = PNT_T.init(0, 0)
vrtx(1) = PNT_T.init(size, 0)
vrtx(2) = PNT_T.init(size, size)
vrtx(3) = PNT_T.init(0, size)
Dim ans_pos As f_cg_pnt_pos
#If PNT_INNER Then
pnt.x = size \ 2
pnt.y = size \ 2
ans_pos = f_cg_pnt_pos.F_CG_INNER_PNT
#Else
pnt.x = size * 2
pnt.y = size * 2
ans_pos = f_cg_pnt_pos.F_CG_OUTER_PNT
#End If
status = api.fnFIE_cg_pos_point_to_simple_polygon(pnt, vrtx, num, pos)
Assert.IsTrue(status = CInt(f_err.F_ERR_NONE), "エラーが発生しました。({0})", CType(status, f_err))
ConsoleOut.WriteFunctionName(": " & vbTab)
Console.Write("pos = {0} ...", pos)
ConsoleOut.IsTrue(pos = ans_pos)
Finally
vrtx.Dispose()
End Try
End Sub
End Class |
See Also