Creating 3D circle with a socket
im trying to create a 3D socket that it basis is a circle shape.
im trying to do it using 9 controls points and quadritc beziar curves , but the continuty im getting betwwen the curves looking ugly, is there any other way to create it? does cubic curves will get better results?
------------------------------- Goblineye Entertainment------------------------------
Not sure what you mean by socket...
There was a thread several weeks ago that discussed how to form a shape that was a sine wave wrapped around a circle. I gave an analytic solution that would have produced a smooth looking curve, as long as the wavelength was an integer multiple of the circumference of the circle. Try looking back through the archives for December, and you might find that thread.
Graham Rhodes
Senior Scientist
Applied Research Associates, Inc.
There was a thread several weeks ago that discussed how to form a shape that was a sine wave wrapped around a circle. I gave an analytic solution that would have produced a smooth looking curve, as long as the wavelength was an integer multiple of the circumference of the circle. Try looking back through the archives for December, and you might find that thread.
Graham Rhodes
Senior Scientist
Applied Research Associates, Inc.
Graham Rhodes Moderator, Math & Physics forum @ gamedev.net
It seems like a catmul-rom spline would be a better way to accomplish what it sounds like you are trying to do. I created this in response to another thread.
A catmul-rom spline takes four control points similar to a bezier. The link is how to convert from a standard cubic to a bezier to a catmul-rom. The four control points on a catmul-rom all lie on the curve and you draw the segment from the second to third control point as you vary the parameter, t, from 0 to 1. So if you have nine control points running in a loop numbered from p1 to p9 then you use (p9,p1,p2,p3), (p1,p2,p3,p4), ... , (p8,p9,p1,p2) as control points for nine segments. The advantage being that the curve and first derivatives are both contineous.
[edited by - LilBudyWizer on January 8, 2003 1:13:07 AM]
A catmul-rom spline takes four control points similar to a bezier. The link is how to convert from a standard cubic to a bezier to a catmul-rom. The four control points on a catmul-rom all lie on the curve and you draw the segment from the second to third control point as you vary the parameter, t, from 0 to 1. So if you have nine control points running in a loop numbered from p1 to p9 then you use (p9,p1,p2,p3), (p1,p2,p3,p4), ... , (p8,p9,p1,p2) as control points for nine segments. The advantage being that the curve and first derivatives are both contineous.
[edited by - LilBudyWizer on January 8, 2003 1:13:07 AM]
Keys to success: Ability, ambition and opportunity.
well , before i try new way i will expline how im doing it now:
my procedure get the radius of the circle , the top point of the bezier (quadritc bezier) and the level of detail of the beziar (num of point). first i define the main bezier (horizontal) on the XY plane:
p1 = (radius,0,0)
p2 = top_point
p3 = (-radius,0,0)
now for each point on the bezier im creating a sub-bezier (vertical) like that:
// the x,y values are the x,y values of the point on the main bezier , i assume that the origin of the circle basis is on (0,0,0) , so we know that the analitic circle define is R^2 = (x - a)^2 + (y - b)^2 from here we can derive Y , coz we have X and the radius, we will use Y as our Z value
p1 = (0,0,sqrt(radius^2 - x^2))
p2 = (x,y,0)
p3 = (0,0,-sqrt(radius^2 - x^2))
it looks like that from top:

BLUE line - main bezier
GREEN lines - sub beziers
and thats what im getting:

(using point list to render it)
as u can see its not good coz i only get a single point on the left and right edges of the mesh - not a bezier , so shape im getting will have sharp edges if i will use low - medium level of detail... which is not good...
is there any other way to do it?
[edited by - xeno on January 8, 2003 10:34:08 AM]
[edited by - xeno on January 8, 2003 10:36:48 AM]
my procedure get the radius of the circle , the top point of the bezier (quadritc bezier) and the level of detail of the beziar (num of point). first i define the main bezier (horizontal) on the XY plane:
p1 = (radius,0,0)
p2 = top_point
p3 = (-radius,0,0)
now for each point on the bezier im creating a sub-bezier (vertical) like that:
// the x,y values are the x,y values of the point on the main bezier , i assume that the origin of the circle basis is on (0,0,0) , so we know that the analitic circle define is R^2 = (x - a)^2 + (y - b)^2 from here we can derive Y , coz we have X and the radius, we will use Y as our Z value
p1 = (0,0,sqrt(radius^2 - x^2))
p2 = (x,y,0)
p3 = (0,0,-sqrt(radius^2 - x^2))
it looks like that from top:

BLUE line - main bezier
GREEN lines - sub beziers
and thats what im getting:

(using point list to render it)
as u can see its not good coz i only get a single point on the left and right edges of the mesh - not a bezier , so shape im getting will have sharp edges if i will use low - medium level of detail... which is not good...
is there any other way to do it?
[edited by - xeno on January 8, 2003 10:34:08 AM]
[edited by - xeno on January 8, 2003 10:36:48 AM]
------------------------------- Goblineye Entertainment------------------------------
anyone?

------------------------------- Goblineye Entertainment------------------------------
Xeno,
Can you draw a picture of what you want to produce? I still don''t understand what you are trying to do.
Graham Rhodes
Senior Scientist
Applied Research Associates, Inc.
Can you draw a picture of what you want to produce? I still don''t understand what you are trying to do.
Graham Rhodes
Senior Scientist
Applied Research Associates, Inc.
Graham Rhodes Moderator, Math & Physics forum @ gamedev.net
I think the problem is the one main bezier. The easiest change I think would be to use many main beziers. The outter control points for each is a diameter of the circle with that diameter rotating. The center control point is the same for each of them with that control point being how you actually control the shape.
It seems like they might all converge at a parameter value of .5. If so then you can do strips around by doing like 0 to .1, .1 to .2 and so forth building up rings. Then one fan at the top capping it all off. You are still going to converge to one point. With a wireframe it is really going to look best if you do. I made an approximation of a sphere using six cubic bezier patchs and it was pretty ugly. The vertices where within 1% of the radius from the center, but you couldn''t even tell it was a sphere in wireframe.
Really you are using bezier patchs, but a whole lot of them. The problem is the circular base. It is much the same as using pixels in a rectangular array to draw a circle. Four quadradic beziers won''t even come close to approximating a circle. Four cubics could come reasonably close though the resulting patch will not come close to approximating a hemisphere. You might be able to do close to what you want with one cubic bezier patch.
You start by laying out four cubic beziers in a plane so that they reasonably form a circle. Basically draw a square and your outter control points are the midpoints of the side. The inner control points are between the outter control point and adjacent corner. The easiest is to just play with it to figure out exactly where. You have eight inner control points, but you only need to play with one while the rest move correspondingly. Draw a circle, draw the four beziers and slide one control point between the midpoint and corner until it looks good. You might try .5 and .717 to start to see how they look.
Once you have the base looking like a reasonable circle then you have 12 of the 16 control points needed for a cubic bezier patch. Making the other four control points the same point may work fine for what you are doing. If you do then you are basically going to have a cone with the surface tangent to the side(s) of the cone at the base. Somewhat like having a round diaphram in a round holder and pushing somewhere in the middle. You could also set them semi-independantly by like move one along a diagonal with the others moving correspondingly. That gives you two degrees of freedom, translation along two axes, which makes it fairly easy to control. Moving them completely independantly with three degrees of freedom will basically make it really easy to make really screwed up shapes. Since you most likely don''t want indentations you most likely don''t want to do that.
That will eliminate your convergence to one point. It is going to be a rectangular grid stretched. The main advantage is that it is a single surface. That may make tesselation a bit simplier since all you have to do is change the increment on the parameters. You also don''t have to worry about where they actually converge at. If the rotating diameter actually works out to converging at .5 that is all fine and wonderful, but there is a good chance that is only true when you have severe constraints on the center control point. Overall bezier patchs are fun to play with and you might as well take the time to learn them since you are getting into things they are perfectly suited for.
Here is a link to an article on beier patchs that uses quadradic beziers. It is fairly straight forward to derive a bicubic patch if you just think about it as the product of two bezier space curves. Four terms times four terms making 16 terms corresponding to the 16 control points.
It seems like they might all converge at a parameter value of .5. If so then you can do strips around by doing like 0 to .1, .1 to .2 and so forth building up rings. Then one fan at the top capping it all off. You are still going to converge to one point. With a wireframe it is really going to look best if you do. I made an approximation of a sphere using six cubic bezier patchs and it was pretty ugly. The vertices where within 1% of the radius from the center, but you couldn''t even tell it was a sphere in wireframe.
Really you are using bezier patchs, but a whole lot of them. The problem is the circular base. It is much the same as using pixels in a rectangular array to draw a circle. Four quadradic beziers won''t even come close to approximating a circle. Four cubics could come reasonably close though the resulting patch will not come close to approximating a hemisphere. You might be able to do close to what you want with one cubic bezier patch.
You start by laying out four cubic beziers in a plane so that they reasonably form a circle. Basically draw a square and your outter control points are the midpoints of the side. The inner control points are between the outter control point and adjacent corner. The easiest is to just play with it to figure out exactly where. You have eight inner control points, but you only need to play with one while the rest move correspondingly. Draw a circle, draw the four beziers and slide one control point between the midpoint and corner until it looks good. You might try .5 and .717 to start to see how they look.
Once you have the base looking like a reasonable circle then you have 12 of the 16 control points needed for a cubic bezier patch. Making the other four control points the same point may work fine for what you are doing. If you do then you are basically going to have a cone with the surface tangent to the side(s) of the cone at the base. Somewhat like having a round diaphram in a round holder and pushing somewhere in the middle. You could also set them semi-independantly by like move one along a diagonal with the others moving correspondingly. That gives you two degrees of freedom, translation along two axes, which makes it fairly easy to control. Moving them completely independantly with three degrees of freedom will basically make it really easy to make really screwed up shapes. Since you most likely don''t want indentations you most likely don''t want to do that.
That will eliminate your convergence to one point. It is going to be a rectangular grid stretched. The main advantage is that it is a single surface. That may make tesselation a bit simplier since all you have to do is change the increment on the parameters. You also don''t have to worry about where they actually converge at. If the rotating diameter actually works out to converging at .5 that is all fine and wonderful, but there is a good chance that is only true when you have severe constraints on the center control point. Overall bezier patchs are fun to play with and you might as well take the time to learn them since you are getting into things they are perfectly suited for.
Here is a link to an article on beier patchs that uses quadradic beziers. It is fairly straight forward to derive a bicubic patch if you just think about it as the product of two bezier space curves. Four terms times four terms making 16 terms corresponding to the 16 control points.
Keys to success: Ability, ambition and opportunity.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement