curve()

Draws a curve as defined by four or more control points. First and last control point define the endpoints of the curve. Control points in between define the shape of the curve. curve() produces NURBS curves. Line width and color are set with glLineWidth() glColor4f(), respectively.

curve([x1, y1], [x2, y2], [x3, y3] ... )
curve([x1, y1, z1], [x2, y2, z2], [x3, y3, z3] ... )
  • x1, y1, z1 ... coordinates of the first control point
  • x2, y2, z2 ... coordinates of the second control point
  • x3, y3, z3 ... coordinates of the third control point
  • Four or more control points needed.

Relevant examples: shape2D.py , shape3D.py , points.py , curve.py , line.py , ALL

In Context

def onDrawOrtho(self):
    curve([0, 200],
          [10, -100], 
          [300, 300], 
          [400, 200])
def onDrawOrtho(self):
    glColor4f(1.0, 0.5, 0.5, 1.0)
    glLineWidth(2)
    curve([0, 200],
          [10, -100], 
          [300, 300], 
          [400, 200])
def onDraw(self):
    curve([-2, 0, 0],
           [-1.8, 1.0, -3],
           [-1.4, -1.0, 2],
           [0, 0.5, 1],
           [2, 0, 0]) 
Initiated by Stephan Hechenberger
Thanks to CADRE's 103