NurbsSurfaceMesh.GetClosestSurfacePosition2 operator

説明

サーフェイスのインデックス、サーフェイス上のポイントの位置、UV 値および指定された位置からの距離の 2 乗を戻します。データは 1D 配列で戻されます。順序は NurbsSurfaceMesh.GetClosestSurfacePosition メソッドの出力引数と同じです。

注:このメソッドは、JScriptやPerlScriptなどの引数の参照渡しをサポートしないスクリプト言語で使用する必要があります。出力引数の取得の詳細については、About Output Argument Arrays を参照してください。

C#構文

Object NurbsSurfaceMesh.GetClosestSurfacePosition2( Object in_vPosition );

スクリプト構文

oArray = NurbsSurfaceMesh.GetClosestSurfacePosition2( Position );

戻り値

VariantArray。順序は Index、SquaredDistance、UValue、VValue、Position です。

パラメータ

パラメータ タイプ 説明
Position SIVector3または 3 つのエレメントからなる 1DArray NurbsSurfaceMesh オブジェクトの参照フレームとして表現される位置

JScript の例

// This example shows how to retrieve the control points returned by 

// NurbsSurface.GetClosestSurfacePosition2

var oRoot = Application.ActiveProject.ActiveScene.Root;

var oSphere = oRoot.AddGeometry( "Sphere", "NurbsSurface" );

// Translate the sphere

oSphere.Kinematics.Global.Parameters("posx").value = oSphere.Kinematics.Global.Parameters("posx").value + 13;

var oPosition = XSIMath.CreateVector3();

oPosition.Set( 0.0, 0.0, 0.0 );

// convert VB array to JScript array

var vbArgs = new VBArray(oSphere.ActivePrimitive.Geometry.GetClosestSurfacePosition2(oPosition));

var args = vbArgs.toArray();

LogMessage( "The origin is closest to surface : " + args[0] + " its distance from it is " + Math.sqrt(args[1]) );

LogMessage( "The UV values are U : " + args[2] + " V :" + args[3] );

LogMessage( "The corresponding position is X : " + args[4].X + " Y :" + args[4].Y + " Z :" + args[4].Z );

関連項目

NurbsSurfaceMesh.GetClosestSurfacePosition