NurbsCurve.EvaluatePositionFromPercentage operator

説明

カーブに沿った指定されたパーセンテージにおける、位置、U 方向のタンジェント、法線、および従法線を含む 3D ベクトルを戻します。

C#構文

Object NurbsCurve.EvaluatePositionFromPercentage( Double in_dPercentage );

スクリプト構文

oArray = NurbsCurve.EvaluatePositionFromPercentage( Percentage );

戻り値

位置、タンジェント、法線、および従法線を含む1DArrayを戻します。

パラメータ

パラメータ タイプ 説明
Percentage Double カーブを評価する位置における、カーブの長さのパーセンテージ(値は 0.0から100.0まで)

1. VBScript の例

set oRoot = Application.ActiveProject.ActiveScene.Root

set oArc = oRoot.AddGeometry( "Arc", "NurbsCurve" )

aValues = oArc.ActivePrimitive.Geometry.Curves(0).EvaluatePositionFromPercentage( 70.0 )

set oPosition = aValues(0)

logmessage "The position at 70%% of the curve is x :" &  oPosition.x	& " y: " & oPosition.y & " z: " & oPosition.z

set oUTangent = aValues(1)

logmessage "The tangent in U at 70%% of the curve is x :" & oUTangent.x & " y: " & oUTangent.y & " z: " & oUTangent.z

set oNormal = aValues(2)

logmessage "The normal at 70%% of the curve is x :" & oNormal.x & " y: " & oNormal.y & " z: " & oNormal.z

set oBiNormal = aValues(3)

logmessage "The bi-normal at 70%% of the curve is x :" & oBiNormal.x & " y: " & oBiNormal.y & " z: " & oBiNormal.z

2. JScript の例

SICreateCurve("crvlist", 3, 0);

SIAddPointOnCurveAtEnd("crvlist", -3.951, 0.000, 1.651, false);

SIAddPointOnCurveAtEnd("crvlist", -3.214, 0.000, -1.884, false);

SIAddPointOnCurveAtEnd("crvlist", -0.592, 0.000, 1.146, false);

SIAddPointOnCurveAtEnd("crvlist", 1.660, 0.000, 2.856, false);

SIAddPointOnCurveAtEnd("crvlist", 3.272, 0.000, -1.224, false);

GetNurbsCurveListInfo( GetValue("crvlist") );

function GetNurbsCurveListInfo( oCurveList )

{

	var oPosition, oUTangent, oNormal, oBiNormal;

	var p = XSIMath.CreateVector3();

	oGeometry = oCurveList.ActivePrimitive.Geometry;

	// Display curve list info

	LogMessage( "    Name: " + oCurveList.Name );

	LogMessage( "FullName: " + oCurveList.FullName );

	LogMessage( "    Type: " + oCurveList.Type );

	// Display geometry info:

	LogMessage( "      Length: " + oGeometry.Length );

	LogMessage( "      Closed: " + oGeometry.Closed );

	LogMessage( "   Nb Points: " + oGeometry.Points.Count );

	LogMessage( "  Nb Control: " + oGeometry.ControlPoints.Count );

	LogMessage( "   Nb Curves: " + oGeometry.Curves.Count );

	LogMessage( "   Nb Facets: " + oGeometry.Facets.Count );

	LogMessage( " Nb Segments: " + oGeometry.Segments.Count );

	LogMessage( " Nb Clusters: " + oGeometry.Clusters.Count );

	LogMessage( "Nb Triangles: " + oGeometry.Triangles.Count ); //crashes Softimage

	// Get the lower-level stuff

	for ( i = 0; i < oGeometry.Curves.Count; i++ ) 

	{

		LogMessage( "--- Curve["+i+"] ---" );

		oCurve = oGeometry.Curves(i);

		// Find the midpont along the curve

		var aValues = new VBArray(oCurve.EvaluatePositionFromPercentage( 50.0 ));

		var oPosition = aValues.getItem(0);

		var oUTangent = aValues.getItem(1);

		var oNormal = aValues.getItem(2);

		var oBiNormal = aValues.getItem(3);

		LogMessage( " Position[x,y,z]: " + oPosition.x +","+ oPosition.y +","+ oPosition.z );

		LogMessage( "U Tangent[x,y,z]: " + oUTangent.x +","+ oUTangent.y +","+ oUTangent.z );

		LogMessage( "   Normal[x,y,z]: " + oNormal.x   +","+ oNormal.y +","+ oNormal.z   );

		LogMessage( "Bi Normal[x,y,z]: " + oBiNormal.x +","+ oBiNormal.y +","+ oBiNormal.z );

		// Display the info

		LogMessage( "   Nb Knots: " + oCurve.Knots.Count );

		LogMessage( "   Degree: "   + oCurve.Degree      );

	}

	return(0);

}

関連項目

NurbsCurve.GetPercentageFromU NurbsCurve.GetUFromPercentage