Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: Bezier Curve
Replies: 0  

Advanced Search

Back to Topic List Back to Topic List  
mahsa

Posts: 6
Registered: 9/26/13
Bezier Curve
Posted: Sep 26, 2013 8:37 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Plotting Beziar curve by having

My problem: I have coordinate and tangent of first point and the end point of Bezier curve and I should draw Bezier Curve in MATLAB. What I did is extracting two control points from the below formulae:
First point= p0; end point=p1; two control point=c0 & c1

B(t)=(1-t)^3*p0+3*(t)*(1-t)^2*c0+3*(1-t)*(t)^2*c1+t^3*p1

C0=(B?(0)+3*p0)/3
C1=(-B?(1)+3p1)/3
Then when I plot it, it would be like a straight line (because c0 and c1 will be so closed to the first and end point. Also following is my Matlab code:

p0=[0;0;0];

diff_b1=[1;0;1]
diff_b0=[0;0;1]
p1=[10;0;20]

c0=(diff_b0+(3*p0))/3
c1=(-diff_b1+(3*p1))/3

counter=0;
for t=0:0.05:1
counter=counter+1;
b(counter,:)=[(1-t)^3*p0+3*(t)*(1-t)^2*c0+3*(1-t)*(t)^2*c1+t^3*p1]';
end
plot3(b(:,1),b(:,2),b(:,3))



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.