How can i express many bezier curve in one figure?
5 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I have function of bezier curve, like this
---------------------------------------------------------
function P=BezierCurve(CV,nPoints)
nCV=size(CV,1)
n=nCV-1;
u=linspace(0,1,nPoints)';
B=zeros(length(u),nCV);
U=zeros(length(u),nCV);
for i=0:n
B(:,i+1)=factorial(n)/(factorial(i)*factorial(n-i));
U(:,i+1)=u.^i.*(1-u).^(n-i);
end
P=B.*U*CV;
close all
CV=[0 0 0;
1 0 0;
1 1 0;
5 10 0]
CV2=[1 1 1;
3 0 1;
4 1 2;
8 10 9]
CV3=[0 100 0;
3 0 1;
4 1 2;
8 10 9]
nPoints=100;
P=BezierCurve(CV, nPoints);
figure;hold on; grid on;
% plot Bezier Curve
plot3(P(:,1), P(:,2), P(:,3),'k')
% plot Control Vertices
plot3(CV(:,1), CV(:,2), CV(:,3),'r:o')
nPoints=100;
P=BezierCurve(CV2, nPoints);
figure;hold on; grid on;
% plot Bezier Curve
plot3(P(:,1), P(:,2), P(:,3),'k')
% plot Control Vertices
plot3(CV2(:,1), CV2(:,2), CV2(:,3),'r:o')
nPoints=100;
P=BezierCurve(CV3, nPoints);
figure;hold on; grid on;
% plot Bezier Curve
plot3(P(:,1), P(:,2), P(:,3),'k')
% plot Control Vertices
plot3(CV3(:,1), CV3(:,2), CV3(:,3),'r:o')
If i execute this, is is expressed in three figures, not in one figure.
what do i need to fix to represent multipole lines in a single figure?
0 commentaires
Réponses (1)
Geoff Hayes
le 11 Oct 2019
Jin - you call
figure;hold on; grid on;
three times and so create three figures. If you just want all the plots on a single figure, then keep the first line that does the above, and remove the last two.
0 commentaires
Voir également
Catégories
En savoir plus sur Interpolation dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!