2
Most read
EXPERIMENT- 6
Objective: - Write a program to draw a cubic Bezier curve.
Software Used: - MATLAB 13
Theory: Four points P0, P1, P2 and P3 in the plane or in higher-dimensional space define a
cubic Bézier curve. The curve starts at P0 going toward P1 and arrives at P3 coming from the
direction of P2. Usually, it will not pass through P1 or P2; these points are only there to provide
directional information. The distance between P0 and P1 determines "how long" the curve moves
into direction P2 before turning towards P3. Writing BPi,Pj,Pk(t) for the quadratic Bézier curve
defined by points Pi , Pj , and Pk, the cubic Bézier curve can be defined as a linear combination
of two quadratic Bézier curves:
The explicit form of the curve is:
For some choices of P1 and P2 the curve may intersect itself, or contain a cusp. Any series of
any 4 distinct points can be converted to a cubic Bézier curve that goes through all 4 points in
order. Given the starting and ending point of some cubic Bézier curve, and the points along the
curve corresponding to t = 1/3 and t = 2/3, the control points for the original Bézier curve can be
recovered.[4] The derivative of the cubic Bézier curve with respect to t is
The second derivative of the Bézier curve with respect to t is
Program:
for i = 1:4
x(i)= input('Enter x coordinate: ');
y(i)= input('Enter y coordinate: ');
end
t=1;
for u = 0.0:0.01:1.0
Bez0(t) = (1-u).^3;
Bez1(t) = (3*u)*(1-u).^2;
Bez2(t) = 3 * (u.^2)*(1-u);
Bez3(t) = (1-u).^3;
X(t) = Bez0(t)*x(1)+Bez1(t)*x(2)+Bez2(t)*x(3)+Bez3(t)*x(4);
Y(t) = Bez0(t)*y(1)+Bez1(t)*y(2)+Bez2(t)*y(3)+Bez3(t)*y(4);
t = t+1;
end
subplot(3,2,1);plot(Bez0);
subplot(3,2,2);plot(Bez1);
subplot(3,2,3);plot(Bez2);
subplot(3,2,4);plot(Bez3);
subplot(3,2,5);plot(x,y,'--rs',X,Y);
Output:
Enter x coordinate: 2
Enter y coordinate: 4
Enter x coordinate: 1
Enter y coordinate: 2
Enter x coordinate: 3
Enter y coordinate: 6
Enter x coordinate: 4
Enter y coordinate: 8

More Related Content

PPTX
Design of couplings
PDF
PPTX
PPTX
Governor
PPT
PPTX
Comparison Centrifugal and axial compessor
PDF
Design and manufacturing of hydraulic cylinders
PDF
#Machine Drawing Complete lecture notes
Design of couplings
Governor
Comparison Centrifugal and axial compessor
Design and manufacturing of hydraulic cylinders
#Machine Drawing Complete lecture notes

What's hot (20)

PDF
PPT
Module 3 hydraulic control valves
PPT
BALANCING OF RECIPROCATING MASSES.ppt
PPTX
PDF
Key and splines
PPTX
PPTX
Cycloidal Curve
PPT
1.3 thread fastener
PDF
Line and end standard
PPTX
superfinishing process
DOCX
elliptical Trammel micro-project report
PPTX
Gear measurements:- MECHANICAL MEASUREMENTS AND METROLOGY
PPTX
Milling and grinding machines
PPTX
Gas turbine
PPTX
PPT
Hydraulics
PPTX
Gyroscopic couple
PPTX
Gear shaping
PDF
Gears and Gear Trains
PPTX
Terminollogy of radial cam
Module 3 hydraulic control valves
BALANCING OF RECIPROCATING MASSES.ppt
Key and splines
Cycloidal Curve
1.3 thread fastener
Line and end standard
superfinishing process
elliptical Trammel micro-project report
Gear measurements:- MECHANICAL MEASUREMENTS AND METROLOGY
Milling and grinding machines
Gas turbine
Hydraulics
Gyroscopic couple
Gear shaping
Gears and Gear Trains
Terminollogy of radial cam
Ad

Viewers also liked (16)

DOCX
Index page of lab file
DOCX
Write a program to perform Orthographic projection.
DOCX
Write a program to perform Perspective projection
DOCX
Progress report for research paper : Download Link in Description
DOCX
Write a program to perform translation
DOCX
Ionic app
DOCX
Window to viewprt
DOCX
Shobhit Portfolio : Download Link in Description
DOCX
Opticalcharacter recognition
DOCX
Cover letter
DOCX
Community outreach portfolio shobhit : Download Link in Description
DOC
WEEKLY PROGRESS REPORT (WPR) for DISSERTATION : Download Link in Description
DOCX
Surface rendering
DOCX
Write a program to perform Oblique projection
DOCX
Write a program to perform translation.
DOCX
Graphics and Graphics Hardware System
Index page of lab file
Write a program to perform Orthographic projection.
Write a program to perform Perspective projection
Progress report for research paper : Download Link in Description
Write a program to perform translation
Ionic app
Window to viewprt
Shobhit Portfolio : Download Link in Description
Opticalcharacter recognition
Cover letter
Community outreach portfolio shobhit : Download Link in Description
WEEKLY PROGRESS REPORT (WPR) for DISSERTATION : Download Link in Description
Surface rendering
Write a program to perform Oblique projection
Write a program to perform translation.
Graphics and Graphics Hardware System
Ad

Similar to Write a program to draw a cubic Bezier curve. (20)

PPTX
Bezier curve
PPT
Curve modeling bezier curves
PDF
Elhabian_curves10.pdf
DOCX
Bezier Curve in Computer Graphics.docx
PPTX
UNIT 2-Geometric Modeling.pptx
PPT
Rendering Curves and Surfaces
PPT
Designing Parametric cubic Curves
PPTX
Synthetics surfaces unit ii
PPTX
5_6221983039971394498.pptx
PPTX
Computer Graphics Introduction To Curves
PPTX
CAD_spline curves, hermite, cubic and cardinal
PDF
Natural and Clamped Cubic Splines
PDF
Module- II (CO-II) Geometric Modelling- straight line, representation of curv...
PDF
curve one
PPTX
Presentation on bezier curve
PDF
Matlab assignment
PPTX
Geometric Curves
PPTX
Techniques for Geometric Modelling
PDF
spline1.pdf computer graphics cad software
PPTX
IPE-409 CAD Ch-3 Techniques for Geometric Modelling.pptx
Bezier curve
Curve modeling bezier curves
Elhabian_curves10.pdf
Bezier Curve in Computer Graphics.docx
UNIT 2-Geometric Modeling.pptx
Rendering Curves and Surfaces
Designing Parametric cubic Curves
Synthetics surfaces unit ii
5_6221983039971394498.pptx
Computer Graphics Introduction To Curves
CAD_spline curves, hermite, cubic and cardinal
Natural and Clamped Cubic Splines
Module- II (CO-II) Geometric Modelling- straight line, representation of curv...
curve one
Presentation on bezier curve
Matlab assignment
Geometric Curves
Techniques for Geometric Modelling
spline1.pdf computer graphics cad software
IPE-409 CAD Ch-3 Techniques for Geometric Modelling.pptx

Recently uploaded (20)

PDF
gsas-cvs-and-cover-letters jhvgfcffttfghgvhg.pdf
PPTX
Cite It Right: A Compact Illustration of APA 7th Edition.pptx
PDF
LATAM’s Top EdTech Innovators Transforming Learning in 2025.pdf
PDF
GIÁO ÁN TIẾNG ANH 7 GLOBAL SUCCESS (CẢ NĂM) THEO CÔNG VĂN 5512 (2 CỘT) NĂM HỌ...
PPTX
Ppt obs emergecy.pptxydirnbduejguxjjdjidjdbuc
PPTX
CHROMIUM & Glucose Tolerance Factor.pptx
PPTX
PAIN PATHWAY & MANAGEMENT OF ACUTE AND CHRONIC PAIN SPEAKER: Dr. Rajasekhar ...
PDF
anganwadi services for the b.sc nursing and GNM
PPTX
Unit1_Kumod_deeplearning.pptx DEEP LEARNING
PDF
HSE 2022-2023.pdf الصحه والسلامه هندسه نفط
PDF
CHALLENGES FACED BY TEACHERS WHEN TEACHING LEARNERS WITH DEVELOPMENTAL DISABI...
PPTX
principlesofmanagementsem1slides-131211060335-phpapp01 (1).ppt
PDF
V02-Session-4-Leadership-Through-Assessment-MLB.pdf
PDF
FAMILY PLANNING (preventative and social medicine pdf)
PPTX
Environmental Sciences and Sustainability Chapter 2
PDF
Jana Ojana 2025 Prelims - School Quiz by Pragya - UEMK Quiz Club
PPTX
Theoretical for class.pptxgshdhddhdhdhgd
PPTX
ENGlishGrade8_Quarter2_WEEK1_LESSON1.pptx
PDF
Global strategy and action plan on oral health 2023 - 2030.pdf
PDF
Kalaari-SaaS-Founder-Playbook-2024-Edition-.pdf
gsas-cvs-and-cover-letters jhvgfcffttfghgvhg.pdf
Cite It Right: A Compact Illustration of APA 7th Edition.pptx
LATAM’s Top EdTech Innovators Transforming Learning in 2025.pdf
GIÁO ÁN TIẾNG ANH 7 GLOBAL SUCCESS (CẢ NĂM) THEO CÔNG VĂN 5512 (2 CỘT) NĂM HỌ...
Ppt obs emergecy.pptxydirnbduejguxjjdjidjdbuc
CHROMIUM & Glucose Tolerance Factor.pptx
PAIN PATHWAY & MANAGEMENT OF ACUTE AND CHRONIC PAIN SPEAKER: Dr. Rajasekhar ...
anganwadi services for the b.sc nursing and GNM
Unit1_Kumod_deeplearning.pptx DEEP LEARNING
HSE 2022-2023.pdf الصحه والسلامه هندسه نفط
CHALLENGES FACED BY TEACHERS WHEN TEACHING LEARNERS WITH DEVELOPMENTAL DISABI...
principlesofmanagementsem1slides-131211060335-phpapp01 (1).ppt
V02-Session-4-Leadership-Through-Assessment-MLB.pdf
FAMILY PLANNING (preventative and social medicine pdf)
Environmental Sciences and Sustainability Chapter 2
Jana Ojana 2025 Prelims - School Quiz by Pragya - UEMK Quiz Club
Theoretical for class.pptxgshdhddhdhdhgd
ENGlishGrade8_Quarter2_WEEK1_LESSON1.pptx
Global strategy and action plan on oral health 2023 - 2030.pdf
Kalaari-SaaS-Founder-Playbook-2024-Edition-.pdf

Write a program to draw a cubic Bezier curve.

  • 1. EXPERIMENT- 6 Objective: - Write a program to draw a cubic Bezier curve. Software Used: - MATLAB 13 Theory: Four points P0, P1, P2 and P3 in the plane or in higher-dimensional space define a cubic Bézier curve. The curve starts at P0 going toward P1 and arrives at P3 coming from the direction of P2. Usually, it will not pass through P1 or P2; these points are only there to provide directional information. The distance between P0 and P1 determines "how long" the curve moves into direction P2 before turning towards P3. Writing BPi,Pj,Pk(t) for the quadratic Bézier curve defined by points Pi , Pj , and Pk, the cubic Bézier curve can be defined as a linear combination of two quadratic Bézier curves: The explicit form of the curve is: For some choices of P1 and P2 the curve may intersect itself, or contain a cusp. Any series of any 4 distinct points can be converted to a cubic Bézier curve that goes through all 4 points in order. Given the starting and ending point of some cubic Bézier curve, and the points along the curve corresponding to t = 1/3 and t = 2/3, the control points for the original Bézier curve can be recovered.[4] The derivative of the cubic Bézier curve with respect to t is The second derivative of the Bézier curve with respect to t is Program: for i = 1:4 x(i)= input('Enter x coordinate: '); y(i)= input('Enter y coordinate: '); end t=1; for u = 0.0:0.01:1.0 Bez0(t) = (1-u).^3; Bez1(t) = (3*u)*(1-u).^2; Bez2(t) = 3 * (u.^2)*(1-u); Bez3(t) = (1-u).^3; X(t) = Bez0(t)*x(1)+Bez1(t)*x(2)+Bez2(t)*x(3)+Bez3(t)*x(4);
  • 2. Y(t) = Bez0(t)*y(1)+Bez1(t)*y(2)+Bez2(t)*y(3)+Bez3(t)*y(4); t = t+1; end subplot(3,2,1);plot(Bez0); subplot(3,2,2);plot(Bez1); subplot(3,2,3);plot(Bez2); subplot(3,2,4);plot(Bez3); subplot(3,2,5);plot(x,y,'--rs',X,Y); Output: Enter x coordinate: 2 Enter y coordinate: 4 Enter x coordinate: 1 Enter y coordinate: 2 Enter x coordinate: 3 Enter y coordinate: 6 Enter x coordinate: 4 Enter y coordinate: 8