set oRoot = Application.activeproject.activescene.root
set oArc = oRoot.AddGeometry( "Arc", "NurbsCurve" )
'Translate the sphere
oArc.Kinematics.Global.Parameters("posx").value = oArc.Kinematics.Global.Parameters("posx").value + 13
set oPos = XSIMath.CreateVector3
oPos.Set 0.0, 0.0, 0.0
set oPosition = XSIMath.MapWorldPositionToObjectSpace(oArc.Kinematics.local.transform, oPos)
oArc.ActivePrimitive.Geometry.GetClosestCurvePosition oPosition, CurveIndex, squaredDistance, UValue, CurvePosition
logmessage "The origin is closest to curve : " & CurveIndex & " its distance from it is " & sqr(squaredDistance)
logmessage "The U values is " & UValue
logmessage "The corresponding position is X : " & CurvePosition.X & " Y :" & CurvePosition.Y & " Z :" & CurvePosition.Z
oArc.ActivePrimitive.Geometry.GetClosestCurvePosition Array(0.0, 0.0, 0.0), CurveIndex, squaredDistance, UValue, CurvePosition
logmessage "The origin is closest to surface : " & CurveIndex & " its distance from it is " & sqr(squaredDistance)
logmessage "The U values is " & UValue
logmessage "The corresponding position is X : " & CurvePosition.X & " Y :" & CurvePosition.Y & " Z :" & CurvePosition.Z
|