直線の角度の算出
Namespace: fvalgcliAssembly: fvalgcli (in fvalgcli.dll) Version: 3.1.0.0 (3.1.0.11)
Syntax
C# |
---|
public static int fnFIE_cg_calc_angle_for_line(
DLINE_T line,
f_direction direction,
ref double angle
) |
Visual Basic |
---|
Public Shared Function fnFIE_cg_calc_angle_for_line (
line As DLINE_T,
direction As f_direction,
ByRef angle As Double
) As Integer |
Parameters
- line
- Type: fvalgcli..::..DLINE_T
直線
- direction
- Type: fvalgcli..::..f_direction
直線の方向
- F_DIRECT_RIGHT 角度範囲(単位:ラジアン): [ -π/2 , π/2]
- F_DIRECT_LEFT 角度範囲(単位:ラジアン): [ π/2 , π ] & [-π/2 ,-π ]
- F_DIRECT_DOWN 角度範囲(単位:ラジアン): [ 0, ]
- angle
- Type: System..::..Double%
直線の角度(単位:ラジアン)
Return Value
Type:
Int32
以下のエラーコードを返します。
エラーコード:f_err | 内容 |
---|
F_ERR_NONE | 正常終了 |
F_ERR_INVALID_PARAM | 不正なパラメータが渡された |
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_calc_angle_for_line()
{
int status = (int)f_err.F_ERR_NONE;
DLINE_T line = new DLINE_T();
double angle = new double();
const double ans_angle = 45;
line.a = 1;
line.b = -1;
line.c = 0;
status = api.fnFIE_cg_calc_angle_for_line(line, f_direction.F_DIRECT_RIGHT, ref angle);
Assert.IsTrue(status == (int)f_err.F_ERR_NONE, "エラーが発生しました。({0})", (f_err)status);
ConsoleOut.WriteFunctionName(":\n");
Console.WriteLine("angle = {0}", angle * 180 / Math.PI);
Console.Write(" ...");
ConsoleOut.IsTrue(angle * 180 / Math.PI == ans_angle);
}
}
} |
Visual Basic | Copy |
---|
Imports System.Collections.Generic
Imports System.Text
Imports fvalgcli
Public Partial Class FIE
<FvPluginExecute> _
Public Sub fnFIE_cg_calc_angle_for_line()
Dim status As Integer = CInt(f_err.F_ERR_NONE)
Dim line As New DLINE_T()
Dim angle As New Double()
Const ans_angle As Double = 45
line.a = 1
line.b = -1
line.c = 0
status = api.fnFIE_cg_calc_angle_for_line(line, f_direction.F_DIRECT_RIGHT, angle)
Assert.IsTrue(status = CInt(f_err.F_ERR_NONE), "エラーが発生しました。({0})", CType(status, f_err))
ConsoleOut.WriteFunctionName(":" & vbLf)
Console.WriteLine("angle = {0}", angle * 180 / Math.PI)
Console.Write(" ...")
ConsoleOut.IsTrue(angle * 180 / Math.PI = ans_angle)
End Sub
End Class |
See Also