![]() |
【转帖】odgenurbcurve3devalpoint for closed spline
odgenurbcurve3d::evalpoint for closed spline
odgenurbcurve3d::evalpoint for closed spline hi, i am using odgenurbcurve3d to get splinefitted and curvefitted points.. for a 2dpolyline.. i am creating odgenurbcurve3d by knots and control points.. code: odgepoint3darray cntrlpoints; oddbobjectiteratorptr pvertiter = ppoly->vertexiterator(); for (; !pvertiter->done(); pvertiter->step()) { oddb2dvertexptr pvertex = pvertiter->entity( oddb::kforwrite); cntrlpoints.push_back( pvertex->position()); } odgedoublearray knots, weights; if( bisclosed)//for closed 2dpolyline { knots.resize( nvertex); for( int i = 0; i < nvertex; i++) knots[i] = i; } else { knots.resize( nvertex + ndegree + 1); for( int i = 0; i <= ndegree; i++) knots[i] = 0; for( i = ndegree+1; i <= nvertex; i++) knots[i] = i - ndegree; for( i = nvertex+1; i < nvertex + ndegree + 1; i++) knots[i] = nvertex - ndegree; nstartknotindex = ndegree; } odgeknotvector knotvector( knots); weights.resize( nvertex, 1.0); //now creating nurbcurve ...... odgenurbcurve3d gespline( ndegree, knotvector, cntrlpoints, weights, bisclosed); // after spline is created... evalpoint() is called at some for tha parameters..... odgepoint3d point = gespline.evalpoint( paramt); ...... ... now evalpoint() funtion is working fine for open gespline but when i am called it when bisclosed is true..(for closed polyline..) then it is throwing error as "not applicable please help me... how do i get the correct spline fitted vertices for closed one... thank you alot......... .................................................. ......................... please note these two facts: 1) the number of knots, control points and degree of nurbs curve must be under the following formula: number of knots = number of control points + degree + 1; 2) the start parameter for nurbs curve is knots[degree]. the end parameter is knots[number of knots - degree - 1]. attempting to call evalpoint() with argument out of these bounds will cause enotapplicable exception. hope this helps. sincerely yours, george udov |
所有的时间均为北京时间。 现在的时间是 10:07 PM. |