Solved

deCastleJau Bezier curves in OpenGL

Posted on 2002-04-16
1
574 Views
Last Modified: 2011-10-03
Somebody please have mercy on me.  I have an assignment that asks the following:

Implement the deCastleJau Algorithm for Bezier curves.  You must use OpenGL function calls for line drawing to approximate the curves.

Your program must draw and display an approximation of the following shapes using cubic Bezier curves and using two different levels of subdivision, rough and smooth.

1. 4 Concentric Circles of radius r,  2r, 3r, 4r.  Pick a reasonable value for r.

2.  An outline of the letter Q.

3.  The fuction y = sin((Pi)x)/(Pi)x
    with {x: -2.0, 2.0}
4.  A crude animal or fungus of your choosing.

Like I said in the first statement - somebody please have mercy on me and tell me how to code this in C.
0
Comment
Question by:GeorgeAntoan
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 4

Accepted Solution

by:
ct.smith earned 200 total points
ID: 6946298
/* Usual spiel about not doing homework on EE goes here */

I do have some good pseudocode for the cubic case of subdivision for de Castlejau's algorithm:

Polyline subBezier (polyline P)
  // Input is polyline P
  // n is number of P points (coarse polyline)
  // O is output polyline (fine polyline)
  j=0;
  for ( i=0 ; i<n ; i=+3)
    O[j]=P[i];
    O[j+1]=(P[i] + P[i+1])/2
    O[j+5]=(P[i+2] + P[i+3])/2
    t = (P[i+1] + P[i+2])/2
    O[j+2]=(t + O[j+1])/2
    O[j+4]=(t + O[j+5])/2
    O[j+3]=(O[j+2] + O[j+4])/2
    j=j+6;
  endfor
Return O

This pseudocode is the place to start (or at least where I started when I implemented it).  If you have some more specific questions, I'll answer if I can.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This tutorial is posted by Aaron Wojnowski, administrator at SDKExpert.net.  To view more iPhone tutorials, visit www.sdkexpert.net. This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
Windows programmers of the C/C++ variety, how many of you realise that since Window 9x Microsoft has been lying to you about what constitutes Unicode (http://en.wikipedia.org/wiki/Unicode)? They will have you believe that Unicode requires you to use…
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use for-loops in the C programming language.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use nested-loops in the C programming language.

732 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question