bezier surface patch for surface of revolution

60 Views Asked by At

I have the following control points for 2 bezier surface patches trying to build a surface of revolution out of them.

float ctlpoints[][4] ={{-2,-1, 0, 1}, {0, 0, 2, 0}, {2,-1, 0, 1}, {-3, 0, 0, 1}, {0, 0, 3, 0}, {3, 0, 0, 1}, {-1.5 , 0.5 , 0, 1}, {0, 0, 1.5 , 0}, {1.5 , 0.5 , 0, 1}, {-2, 1, 0, 1}, {0, 0, 2, 0}, {2, 1, 0, 1}}; float ctlpointsB[][4] ={{-2,-1, 0, 1}, {0, 0, -2, 0}, {2,-1, 0, 1}, {-3, 0, 0, 1}, {0, 0, -3, 0}, {3, 0, 0, 1}, {-1.5 , 0.5 , 0, 1}, {0, 0, -1.5 , 0}, {1.5 , 0.5 , 0, 1}, {-2, 1, 0, 1}, {0, 0, -2, 0}, {2, 1, 0, 1}};

these are 4 control points of a vertical curve in the x,y plane given by

(2,-1,0), (3,0,0), (1.5,0.5,0), (2,1,0)

then expanding each into 3 homogeneous control points to draw a semicircle horizontally both front (in the first 12 points) and back (in the second 12 points). For example the first point is expanded into:

{-2,-1, 0, 1},{0, 0, 2, 0},{2,-1, 0, 1}

at the front. In the back it is expanded into:

{-2,-1, 0, 1},{0, 0, -2, 0},{2,-1, 0, 1}

However the 2 halves (front and back) do not join smoothly (I expect the tangents at common end points to be at least G-1 continuous). What I get is shown in this image1

I am not sure if the surface can ever be generated this way or not? I generated the surface from the bezier curve defined by the 4 above points in the x,y plane, by revolving it around the origin for 360 degrees[here it is textured in this image2]. I just can't prove or disprove that it can be generated from the above mentioned 2 halves.

1

There are 1 best solutions below

0
On

Thanks Paul for your illuminating comment, indeed I was doing something wrong. I did not implement the bezier code for generating the patches, I used a third party code and assumed by specifying the dimension as 4, the return point would be in homogeneous coordinates thus I divided by w(ret[3]) in my code. Upon reading your comment I dug deeply into the third party code and found out that the return point had been divided by w ( without setting w to 1). Upon elimination of the division by ret[3], things work fine either way as generation of 2 halves or as one half and its mirror along Z=0.