Get U-position of nurbs curve point? 2004-06-18 - By Felix Gebhardt
Back
Hey Holger, if you use EvaluatePosition with an even number you already have the knot position. At least if the curve parametrisation is non uniform.
Cheers, Felix
-- 8< -- ---- ---- ---- ---- ---- ---- ---- ---- ------
NewScene SICreateCurve "crvlist", 3, 0 SIAddPointOnCurveAtEnd "crvlist", 3, 0, -3, False, 0 SIAddPointOnCurveAtEnd "crvlist", -1, 0, -2, False, 0 SIAddPointOnCurveAtEnd "crvlist", 2, 0, 1, False, 0 SIAddPointOnCurveAtEnd "crvlist", -1, 0, 3, False, 0 SIAddPointOnCurveAtEnd "crvlist", -4, 0, 1, False, 0 SIAddPointOnCurveAtEnd "crvlist", -3, 0, -2, False, 0 SIAddPointOnCurveAtEnd "crvlist", 0, 0, -3, False, 0 SetValue "Views.ViewA.TopCamera.camvis.compobjselknot", True SelectObj "crvlist", , True
set oCurve = Activesceneroot.findchild("crvlist") set oCurveGeo = oCurve.Activeprimitive.Geometry SetObjPos "vPos", oCurveGeo.Curves(0).EvaluatePosition( 1.0 )(0)
'======================================== Function SetObjPos(sChildname, vInVector) '======================================== dim oObj, tTrans
if Not typename(vInVector) = "ISIVector3" then set vInVector = XSIMath.CreateVector3 end if
if typename( Activesceneroot.FindChild ( sChildname ) ) = "Nothing" then set oObj = Activesceneroot.AddNull (sChildname) oObj.parameters("size").value = 0.5 MakeLocal oObj&".display", siNodePropagation SetValue oObj&".display.wirecol", 367 end if
set oObj = ActiveSceneRoot.FindChild ( sChildname ) set tTrans = oObj.Kinematics.Local.Transform tTrans.SetTranslation vInVector oObj.Kinematics.Local.Transform = tTrans
'=========== End Function '=========== -- 8< -- ---- ---- ---- ---- ---- ---- ---- ---- ------
Schoenberger wrote: > I unerstood his way, But I would use te position of the knot instead of > the position of the control point to > get the new position. But I forgot that the Knot doesnot have a position > array.... > > damn > > > > >> -- --Original Message-- -- > >> From: owner-xsi@(protected) > >> [mailto:owner-xsi@(protected)] On Behalf Of Bradley Gabe > >> Sent: Friday, June 18, 2004 7:40 PM > >> To: XSI@(protected) > >> Subject: Re: Get U-position of nurbs curve point? > >> > >> > >> What Aloys said... > >> > >> 1- Get a pointer to the ControlPoint collection. > >> 2- Get a pointer to the ControlPoint object at its index > >> in the collection. > >> 3- You can access X,Y,Z values of the point as they are > >> properties of a > >> ControlPoint object. > >> 4- Put the XYZ values into a vector3() object. > >> 5- Even though the control point is not directly on the > >> nurbs curve, you > >> can use the GetClosestCurvePosition() method with the > >> vector3() object > >> as input. It will return a collection of data about the > >> coordinates you > >> input. > >> > >> If you're doing this in jscript, you'll want to search the > >> SDK docs for > >> any jscript examples on these methods. As far as I know, > >> it's the only > >> place to get examples of what data is returned at what > >> index position of > >> the return collection. > >> > >> Good luck. > >> > >> -Brad > >> > >> > Hello, > >> > I think you can't! > >> > The main reason is that control points are not on the > >> curve, only > >> > knots are. > >> > I would advice you to use the GetClosestCurvePosition > >> method of the > >> > NurbsCurveList object with the position of th control > >> point : it will > >> > return you the u value. > >> > Good luck! > >> > > >> > -- > >> > Aloys Baillet - R&D @ La Maison > >> > -- > >> > > >> > > >> > > >> > Schoenberger wrote: > >> > > >> >> Hi > >> >> > >> >> I'm trying to get the position of a nurbs point on a curve. > >> >> Someting like a length from start of the curve to the point. > >> >> I have a little script, that does it, but I need > >> something that works > >> >> with the object model. > >> >> What I have: > >> >> GetCurvePercentageAtKnotIndex "crvlist", > >> MyPointIndex, perc > >> >> clength = GetCurveLength("crvlist") > >> >> PostionOnCurve = clength*perc/100 > >> >> > >> >> Now I want that result, but with the object model. > >> >> What I have found till now is: > >> >> .Geometry.length > >> >> .Geometry.curves(0).GetPercentageFromU > >> >> .Geometry.curves(0).ControlPoints > >> >> > >> >> > >> >> Perhaps I am stupid or missed something in the docs, > >> but how to get the > >> >> U position of a Control point? > >> >> With the U position I could get the percentage and > >> everything would be > >> >> fine. > >> >> > >> >> > >> >> Holger Sch�nberger technical director > >> >> The day has 24 hours, if that does not suffice, I will > >> take the night > >> >> > >> >> > >> >> --- > >> >> Unsubscribe? Mail Majordomo@(protected) with the > >> following text in > >> >> body: > >> >> unsubscribe xsi > >> >> > >> >> > >> >> > >> >> > >> >> > >> > > >> > --- > >> > Unsubscribe? Mail Majordomo@(protected) with the > >> following text in > >> > body: > >> > unsubscribe xsi > >> > > >> > > >> > >> -- > >> Bradley R. Gabe > >> Industrial Light & Magic > >> > >> > >> > >> > >> --- > >> Unsubscribe? Mail Majordomo@(protected) with the > >> following text in body: > >> unsubscribe xsi > >> > > > --- > Unsubscribe? Mail Majordomo@(protected) with the following text in body: > unsubscribe xsi
--- Unsubscribe? Mail Majordomo@(protected) with the following text in body: unsubscribe xsi
|
|