   closed curve line
  I have a set of 3d points, basically defining an octagon shape, and I want to create some sort of bezier curve that closes off the points.  I tried using the OpenGL bezier functions, like the glMap ones but it will not connect each point, and seems to simulate a line that best ''fits'' those points.What I''m trying to do is in my map editor, when the user puts the brush on the terrain, it creates a 3d bezier circle on the ground that conforms to the terrain.  I have about 6 points, each is placed at the appropriate height above the terrain, and I was to create a nice smooth curved circle from these that fits to the slope of the terrain, ect.....Anybody know how to do this? 
  The OpenGL curve functions should work. Just to clarify in case there''s some confusion though, you can''t just feed in all the curve vertices. Each curve segment needs the 2 endpoints of the curve, and 2 control points that are not on the curve, but instead are proportional to the curve''s tangent vector at the endpoints. So to connect 6 points in a loop would require 6 curve segments, and an additional 12 control points; 2 for each segment. ;  Well suppose I have 4 points representing my circle in the shape of a diamond.  So I have let''s say{0, 1, 0}   {1, 0, 0}   {0, -1, 0}  {-1, 0, 0}Where would the control points be for the first 2 points?Should they be like ((P1+P2)/5)*2  and  ((P1+P2)/5))*4 ???What would be appropriate values?;  Ah nuts, I was hoping you wouldn't ask for the details that I don't remember. The idea is that the first control point is the endpoint of the tangent vector at the curve's starting point. So for a simple circle starting at (0,1,0), the tangent vector is [1, 0, 0] going clockwise, and so control point #1 would represent that vector. So the vector starts from (0,1,0) and ends at our control point, which should be (1, 1, 0)*3 (I think the tangent is multiplied by 3 for some reason that escapes me now) which equals (3, 3, 0). The 2nd control point is the starting point of the tangent vector (mult by the magic 3) that goes TO the curve's endpoint, so that control point would be (3, 3, 0) also (only for a circular arc does it match up like that). And you feed it to OpenGL in the following order:Point1, Control1, Control2, Point2.Then the same applies to the next piece of the curve. That's the basic idea anyways, although don't take any details too literally as this is off the top of my head. Its best to do a quick lookup in the OpenGL book or elsewhere just to get a picture of the 4 points and a curve, which is much more intuitive then my explanation (which looks pretty bad now that I'm rereading it, but its 2:30AM). Its really just an issue of telling OpenGL what the tangent vector is at each endpoint though.    [edited by - Rock2000 on February 20, 2004 2:33:32 AM];  When you try to draw a curve, why do you use bezier curves anyway?It is much more simple to compute the circle directly and then project it to the ground (this will REALLY fit it to the terrain):First you need the radius and two tangent vectors u and v, e.g. u=(1,0,0) and v=(0,1,0) if your terrain is in x-y-plane.then you compute  for(n=0; n<=N (=number of circle segments); n++)    angle = 2*PI*n/N    point_on_circle[n] = u*sin(angle) + v*cos(angle)    (Note that point_on_circle[n] is a vector)    Project point_on_circle[n] to the ground    If your terrain is made of triangles, this should be easy.    Just determine which triangle the point is over, then adjuste.g. the z-coordinate.  end;Now draw a line-strip throug all N+1 points on the circle.No need of Bezier...;  Yeah, that''s probably a better solution if only circles are desired.But, since I totally screwed up that Bezier information, let me correct some of it (although I need to read up on them because something still isn''t working). The first control point should be equal to the (1st tangent vector / 3) + P1. So in this case it would be (1/3, 0) + (0, 1) = (1/3, 1). The 2nd control point is P3 = P4 - (2nd tangent / 3), so should be (1, 0) - (0, -1/3) = (1, 1/3). Unfortunately when I plug these into OpenGL, I don''t get a circlular arc, so something off. But I''m not sure what it is. 