ON_BezierSurface Modification

Hi Everyone,

I read a .3dm file from rhino into C++ code using opennurbs library and got the Bezier patches vector from ON_BezierSurface. Now, I want to change the x,y,z values of vertices for each of those quadrilateral patches’ but I can’t rewrite it. I do something like the following. Could anyone help me out? Thanks

        Refined_Beziers[i].PointAt(0,0).x = TempBezier.PointAt(0,0).x;
        Refined_Beziers[i].PointAt(0,0).y = TempBezier.PointAt(0,0).y;
        Refined_Beziers[i].PointAt(0,0).z = TempBezier.PointAt(0,0).z;

Refined_Beziers is a vector of ON_BezierSurfaces. I want assign value from TempBezier which is a ON_BezierSurface. I don’t get any compiling error but it can’t assign the values in this. Please let me know if you have any idea. Thanks

With .PointAt(u, v) you are evaluating the location of a point on the surface at parameters u and v of the Bezier patch. It seems that you want to change the location of the control vertex. Then you must use .CV(i,j) to get a pointer to the memory of the control vertex and assign the values.

But, you should also be able to just use the assignment operator like so, if you want to assign all control vertices at once:

Refined_Beziers[i] = TempBezier;

Hello,

Thank you for the reply. I tried to do in this way but it doesn’t work. Could you please checkout for me? @menno

        ON_BezierSurface test;
        test.Create(3,1,2,2);
        test.SetCV(0,0,Bezier.PointAt(0,0));
        std::cout << test.PointAt(0,0).x<<","<<test.PointAt(0,0).y<<
        ","<<test.PointAt(0,0).z<<'\n';

I am setting only the 1st vertex to test it but I see 0,0,0 in the output which is because of .Create() and seems like that SetCV doesn’t work. I tried to do CV(I,J) but it didn’t work. I want to assign value in Bezier.PointAt(0,0) to test.PointAt(0,0). Thanks

You probably need to set the other control points too, and the weights for the control points to 1.0.