Skip to content

praneetmehta/de-Casteljau-Bezier-Curves

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Assignment 3

Implementation of de Casteljau algorithm for drawing Bezier curves of degree n and the surface of revolution of the drawn curve.

Course Assignment for IS F311- Computer Graphics @ BITS Pilani, Hyderabad Campus.

Done under the guidance of Prof. Tathagata Ray, Associate Professor, BITS Pilani, Hyderabad Campus.

Table of Contents

Table of contents generated with markdown-toc

Instructions to run the scripts

Run the following commands to launch the curve drawing interface:

g++ *.cpp -lglfw -pthread -lGLEW -lGLU -lGL
./a.out

Interface controls

Control Action
LMB Add point (in add mode)/ Move points (in move mode)
RMB Delete point
M Toggle Move mode
A Togle Add mode
Space Write OFF file to disk

Introduction

Bezier curve

A Bezier curve is a parametric curve frequently used in computer graphics and related fields. Bezier curves are completely contained within the convex hull formed by the control points. The blending functions of Bezier curves are Bernstein polynomials which are of the form-

bernstein

The Bezier curve has the equation-

bezier_eq

Bezier

de Casteljau algorithm

De Casteljau's algorithm is a recursive method to evaluate polynomials in Bernstein form or Bézier curves.

Example (degree 3 curve)

1. q0 = Lerp(t, p0, p1), q1 = Lerp(t, p1, p2), q2 = Lerp(t, p2, p3)
1

2. r0 = Lerp(t, q0, q1), r1 = Lerp(t, q1, q2)
2

3. x = Lerp(t, r0, r1)
3

4. Final point
4

When the above steps are repeated across a large no. of values of t between 0 and 1, the following curve results.

decasteljau

Blending functions
bernstein

Program features

Our program has the following features:

  1. An interactive GUI to plot points. The resulting bezier curve from the points is generated and displayed in real-time.
  2. The ability to move and remove plotted points.
  3. The curve is rotated about y-axis to generate the surface of rotation. The resulting surface is stored in OFF format and can be viewed using software such as MeshLab, noesis, etc.

Results

Wine glass

Champagne glass

Grail

Urn

Milk Bottle

Gourd Vase

Round Vase

Mushroom

Members

Shubham Jha

Praneet Mehta

Keyur Jain

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published