楕円と点の距離の算出

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

Syntax

C#
public static int fnFIE_cg_calc_distance_ellipse_to_point(
	DPNT_T center,
	double major,
	double minor,
	double theta,
	DPNT_T point,
	ref double distance,
	ref DPNT_T nearest_point,
	ref bool outer
)
Visual Basic
Public Shared Function fnFIE_cg_calc_distance_ellipse_to_point ( 
	center As DPNT_T,
	major As Double,
	minor As Double,
	theta As Double,
	point As DPNT_T,
	ByRef distance As Double,
	ByRef nearest_point As DPNT_T,
	ByRef outer As Boolean
) As Integer

Parameters

center
Type: fvalgcli..::..DPNT_T
楕円Eの中心座標
major
Type: System..::..Double
楕円Eの主軸長
minor
Type: System..::..Double
楕円Eの副軸長
theta
Type: System..::..Double
楕円Eの主軸傾き (単位:ラジアン)
point
Type: fvalgcli..::..DPNT_T
座標点P1
distance
Type: System..::..Double%
楕円EとP1との最短距離d
nearest_point
Type: fvalgcli..::..DPNT_T%
楕円EとP1との最短距離dを与える、楕円E上の点P2
outer
Type: System..::..Boolean%
P1が楕円Eの外部か内部かの判定結果 [true:楕円上か楕円外部、false:楕円内]

Return Value

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

エラーコード:
f_err内容
F_ERR_NONE正常終了
F_ERR_INVALID_PARAMパラメータ異常
F_ERR_CALC_IMPOSSIBLE計算不能エラー
F_ERR_NO_LICENCEライセンスエラー

Examples

C# Copy imageCopy
//    $Revision: 1.1 $

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

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

            DPNT_T center = DPNT_T.init(243.5, 193.5);
            double major = 127;
            double minor = 86;
            double theta = 0;
            DPNT_T point = DPNT_T.init(478, 345);
            double distance = 0;
            DPNT_T nearest_point = new DPNT_T();
            bool outer = false;

            status = api.fnFIE_cg_calc_distance_ellipse_to_point(center, major, minor, theta, point, ref distance, ref nearest_point, ref outer);

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

            // 結果を出力する.
            ConsoleOut.WriteFunctionName(":\n");
            Console.WriteLine("nearest_point = {0},{1}", nearest_point.x, nearest_point.y);
            Console.WriteLine("distance = {0}", distance);
            Console.WriteLine("outer = {0}", outer);
        }
    }
}


Visual Basic Copy imageCopy
'    $Revision: 1.1 $

Imports System.Collections.Generic
Imports System.Text
Imports fvalgcli

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

        Dim center As DPNT_T = DPNT_T.init(243.5, 193.5)
        Dim major As Double = 127
        Dim minor As Double = 86
        Dim theta As Double = 0
        Dim point As DPNT_T = DPNT_T.init(478, 345)
        Dim distance As Double = 0
        Dim nearest_point As New DPNT_T()
        Dim outer As Boolean = False

        status = api.fnFIE_cg_calc_distance_ellipse_to_point(center, major, minor, theta, point, distance, _
            nearest_point, outer)

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

        ' 結果を出力する.
        ConsoleOut.WriteFunctionName(":" & vbLf)
        Console.WriteLine("nearest_point = {0},{1}", nearest_point.x, nearest_point.y)
        Console.WriteLine("distance = {0}", distance)
        Console.WriteLine("outer = {0}", outer)
    End Sub
End Class

See Also