EvaluatePositionFro mPercentage (NurbsCurve) *

Description

Returns a 3D vector containing the position, tangent in U direction, normal and bi-normal at a given percentage along the curve.

Scripting Syntax

    NurbsCurve.EvaluatePositionFromPercentage( Percentage )

C# Syntax

    Object NurbsCurve.EvaluatePositionFromPercentage( Double in_dPercentage );

Parameters

Parameter | Type | Description
Percentage | Double | The percentange (with values between 0.0 and 100.0 inclusive) of the length of the curve at which we want to evaluate the curve.

Return Value

A 1-dimensional Array containing the position, tangent, normal and bi-normal.

Examples

1. VBScript Example

    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 Example

    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);
    }

See Also

NurbsCurve.GetPercentageFromU | NurbsCurve.GetUFromPercentage

Autodesk Softimage v7.5