最大空円(最大内接円)の計算
Namespace: fvalgcliAssembly: fvalgcli (in fvalgcli.dll) Version: 3.1.0.0 (3.1.0.11)
Syntax
C# |
---|
public static int fnFIE_cg_empty_circle_calc(
PNT_T_PTR pnts,
int num,
ref PNT_T center,
ref int radius2
) |
Visual Basic |
---|
Public Shared Function fnFIE_cg_empty_circle_calc (
pnts As PNT_T_PTR,
num As Integer,
ByRef center As PNT_T,
ByRef radius2 As Integer
) As Integer |
Return Value
Type:
Int32
以下のエラーコードを返します。
エラーコード:f_err | 内容 |
---|
F_ERR_NONE | 正常終了 |
F_ERR_INVALID_PARAM | 不正なパラメータが渡された | 点群によって生成された凸包の頂点が3点未満 ヌルポインタが渡された |
F_ERR_CALC_IMPOSSIBLE | 計算不能 | 凸包の内部に中心を持つ円が無い |
F_ERR_NOMEMORY | メモリ不足 |
F_ERR_NO_LICENCE | ライセンスエラー、または未初期化エラー |
Remarks
Examples
C# | Copy |
---|
using System;
using System.Collections.Generic;
using System.Text;
using fvalgcli;
namespace TC
{
public partial class FIE
{
[FvPluginExecute]
public void fnFIE_cg_empty_circle_calc()
{
int status = (int)f_err.F_ERR_NONE;
PNT_T_PTR pnts = PNT_T_PTR.Zero;
int num;
PNT_T center = new PNT_T();
int radius2 = new int();
const int size_x = 32;
const int size_y = 24;
const int ans_center_x = size_x / 2;
const int ans_center_y = size_y / 2;
const int ans_radius2 = 1;
try
{
num = size_x * size_y - 1;
pnts = PNT_T_PTR.alloc(num);
{
int x = 0; int y = 0;
for (int i = 0; i < num; i++)
{
if (x == ans_center_x && y == ans_center_y) x++;
if (x >= size_x)
{
x = 0; y++;
}
pnts[i] = PNT_T.init(x, y);
x++;
}
}
status = api.fnFIE_cg_empty_circle_calc(pnts, num, ref center, ref radius2);
Assert.IsTrue(status == (int)f_err.F_ERR_NONE, "エラーが発生しました。({0})", (f_err)status);
ConsoleOut.WriteFunctionName(":\t");
Console.Write("center=({0}, {1}), radius2={2} ...", center.x, center.y, radius2);
ConsoleOut.IsTrue(center.x == ans_center_x && center.y == ans_center_y && radius2 == ans_radius2);
}
finally
{
pnts.Dispose();
}
}
}
} |
Visual Basic | Copy |
---|
Imports System.Collections.Generic
Imports System.Text
Imports fvalgcli
Public Partial Class FIE
<FvPluginExecute> _
Public Sub fnFIE_cg_empty_circle_calc()
Dim status As Integer = CInt(f_err.F_ERR_NONE)
Dim pnts As PNT_T_PTR = PNT_T_PTR.Zero
Dim num As Integer
Dim center As New PNT_T()
Dim radius2 As New Integer()
Const size_x As Integer = 32
Const size_y As Integer = 24
Const ans_center_x As Integer = size_x \ 2
Const ans_center_y As Integer = size_y \ 2
Const ans_radius2 As Integer = 1
Try
num = size_x * size_y - 1
pnts = PNT_T_PTR.alloc(num)
If True Then
Dim x As Integer = 0
Dim y As Integer = 0
For i As Integer = 0 To num - 1
If x = ans_center_x AndAlso y = ans_center_y Then
x += 1
End If
If x >= size_x Then
x = 0
y += 1
End If
pnts(i) = PNT_T.init(x, y)
x += 1
Next
End If
status = api.fnFIE_cg_empty_circle_calc(pnts, num, center, radius2)
Assert.IsTrue(status = CInt(f_err.F_ERR_NONE), "エラーが発生しました。({0})", CType(status, f_err))
ConsoleOut.WriteFunctionName(":" & vbTab)
Console.Write("center=({0}, {1}), radius2={2} ...", center.x, center.y, radius2)
ConsoleOut.IsTrue(center.x = ans_center_x AndAlso center.y = ans_center_y AndAlso radius2 = ans_radius2)
Finally
pnts.Dispose()
End Try
End Sub
End Class |
See Also