曲線補間をして、補間点群を取得
Namespace: fvalgcliAssembly: fvalgcli (in fvalgcli.dll) Version: 3.1.0.0 (3.1.0.11)
Syntax
C# |
---|
public static DPNT_T_PTR fnFIE_draw_curve_get_point_set(
DPNT_T_PTR pnts,
int num_pnt,
f_draw_curve_mode mode,
ref int num_inter
) |
Visual Basic |
---|
Public Shared Function fnFIE_draw_curve_get_point_set (
pnts As DPNT_T_PTR,
num_pnt As Integer,
mode As f_draw_curve_mode,
ByRef num_inter As Integer
) As DPNT_T_PTR |
Parameters
- pnts
- Type: fvalgcli..::..DPNT_T_PTR
頂点データ
- num_pnt
- Type: System..::..Int32
頂点の数
- mode
- Type: fvalgcli..::..f_draw_curve_mode
曲線の種類
- F_DRAW_CUBIC_BSPLINE :3次Bスプライン曲線
- F_DRAW_QUADRATIC_BEZIER :2次ベジェ曲線
- F_DRAW_CUBIC_CATMULL_ROM :3次カットマル-ロム曲線
- num_inter
- Type: System..::..Int32%
求められた補間点群の数
Return Value
Type:
DPNT_T_PTR
求められた曲線近似による補間点群の配列の先頭アドレスを返します。
メモリ不足、不正なパラメータが渡された場合、ライセンスエラー、未初期化エラー などで失敗した場合は、IntPtr.Zero を返します。
Examples
C# | Copy |
---|
using System;
using System.Collections.Generic;
using System.Text;
using fvalgcli;
namespace TC
{
public partial class FIE
{
[FvPluginExecute]
public void fnFIE_draw_curve_get_point_set()
{
DPNT_T_PTR pnts = DPNT_T_PTR.Zero;
DPNT_T_PTR ret_obj = DPNT_T_PTR.Zero;
FHANDLE ret_img = FHANDLE.Zero;
DOUBLE_PTR dens_val = IntPtr.Zero;
const int num_pnt = 10;
const f_draw_curve_mode mode = f_draw_curve_mode.F_DRAW_CUBIC_BSPLINE;
int num_inter = 0;
const int width = 64;
const int height = 64;
try
{
pnts = DPNT_T_PTR.alloc(num_pnt);
for (int i = 0; i < num_pnt; i++)
{
double x = i * (width / (num_pnt - 1));
double y = (height - 1) * (0x1 & i);
pnts[i] = DPNT_T.init(x, y);
}
ret_obj = api.fnFIE_draw_curve_get_point_set(pnts, num_pnt, mode, ref num_inter);
Assert.IsFalse(ret_obj == DPNT_T_PTR.Zero, "エラーが発生しました。");
{
ret_img = api.fnFIE_img_root_alloc((int)f_imgtype.F_IMG_UC8, 1, width, height);
api.fnFIE_img_clear(ret_img, 0);
dens_val = DOUBLE_PTR.alloc(1);
dens_val[0] = 255;
for (int i = 0; i < num_inter; i++)
{
api.fnFIE_draw_point(ret_img, dens_val, ret_obj[i]);
}
api.fnFIE_save_png(ResultDir + "/fnFIE_draw_curve_get_point_set.png", ret_img, -1);
}
}
finally
{
ret_obj.Dispose();
ret_img.Dispose();
pnts.Dispose();
dens_val.Dispose();
}
}
}
} |
Visual Basic | Copy |
---|
Imports System.Collections.Generic
Imports System.Text
Imports fvalgcli
Public Partial Class FIE
<FvPluginExecute> _
Public Sub fnFIE_draw_curve_get_point_set()
Dim pnts As DPNT_T_PTR = DPNT_T_PTR.Zero
Dim ret_obj As DPNT_T_PTR = DPNT_T_PTR.Zero
Dim ret_img As FHANDLE = FHANDLE.Zero
Dim dens_val As DOUBLE_PTR = IntPtr.Zero
Const num_pnt As Integer = 10
Const mode As f_draw_curve_mode = f_draw_curve_mode.F_DRAW_CUBIC_BSPLINE
Dim num_inter As Integer = 0
Const width As Integer = 64
Const height As Integer = 64
Try
pnts = DPNT_T_PTR.alloc(num_pnt)
For i As Integer = 0 To num_pnt - 1
Dim x As Double = i * (width \ (num_pnt - 1))
Dim y As Double = (height - 1) * (&H1 And i)
pnts(i) = DPNT_T.init(x, y)
Next
ret_obj = api.fnFIE_draw_curve_get_point_set(pnts, num_pnt, mode, num_inter)
Assert.IsFalse(ret_obj = DPNT_T_PTR.Zero, "エラーが発生しました。")
If True Then
ret_img = api.fnFIE_img_root_alloc(CInt(f_imgtype.F_IMG_UC8), 1, width, height)
api.fnFIE_img_clear(ret_img, 0)
dens_val = DOUBLE_PTR.alloc(1)
dens_val(0) = 255
For i As Integer = 0 To num_inter - 1
api.fnFIE_draw_point(ret_img, dens_val, ret_obj(i))
Next
api.fnFIE_save_png(ResultDir & "/fnFIE_draw_curve_get_point_set.png", ret_img, -1)
End If
Finally
ret_obj.Dispose()
ret_img.Dispose()
pnts.Dispose()
dens_val.Dispose()
End Try
End Sub
End Class |
See Also