/*
This example illustrates how to retreive the spatial position of a knot.
*/
var oSphere = ActiveSceneRoot.AddGeometry( "Sphere", "NurbsSurface" );
var oSurfaces = oSphere.ActivePrimitive.Geometry.Surfaces;
var oSurface = oSurfaces(0);
var aUKnotValues = new VBArray(oSurface.UKnots.Array);
var aVKnotValues = new VBArray(oSurface.VKnots.Array);
var aValues = new VBArray(oSurface.EvaluatePosition2( aUKnotValues.getItem(3), aVKnotValues.getItem(4)));
var oPosition = aValues.getItem(0);
var oUTangent = aValues.getItem(1);
var oVTangent = aValues.getItem(2);
var oNormal = aValues.getItem(3);
LogMessage( "Position: " + oPosition.x + ", " + oPosition.y + ", " + oPosition.z );
LogMessage( "Tan U: " + oUTangent.x + ", " + oUTangent.y + ", " + oUTangent.z );
LogMessage( "Tan V: " + oVTangent .x + ", " + oVTangent .y + ", " + oVTangent .z );
LogMessage( "Normal: " + oNormal.x + ", " + oNormal.y + ", " + oNormal.z );
//--------------------------------------------------
// Output of above script:
//INFO : "Position: -4.718447854656915e-16, -2.828427124746189, 2.8284271247461916"
//INFO : "Tan U: 1, 0, 1.8784326741201244e-16"
//INFO : "Tan V: -5.3007381947367376e-17, 0.706986783671791, 0.7072267583409271"
//INFO : "Normal: -1.3280270746201882e-16, -0.7072267583409272, 0.7069867836717909" |