フィルターのクリア

How to generate surface of revolution from Bezier curve

5 ビュー (過去 30 日間)
Jinesh Savla
Jinesh Savla 2022 年 3 月 17 日
回答済み: Amish 2023 年 10 月 30 日
I am trying to generate revolved surface from bezier curve. I have generated bezier curve but now I do not know how to proceed further. Please help.
Below is the code that I have written and beyone this point I am stuck.
clc
clear
close all
%% Define inout parameters
B = [1,1; 2,3; 4,3; 3,1]; % Creating matrix for polygon vertices
[r,s] = size(B); % getting size of matrix in terms of rows and columns
n = r-1; % n+1 represents number of vertices of the polygon
np = 20; % represents number of equi-distance points on the bezier curve
t = linspace(0,1,np);
%% Plot polygon
for k = 1:n
plot([B(k,1),B(k+1,1)], [B(k,2),B(k+1,2)], 'r', 'LineWidth', 2)
hold on
grid on
end
%% Generate the points on the bezier curve
for j = 1:np
P = [0,0];
for i = 0:n
M(i+1) = (factorial(n)/(factorial(i)*factorial(n-i)))*((t(j))^i)*((1-t(j))^(n-i));
P = P + B(i+1,:)*M(i+1);
end
Q(j,:) = P;
end
%% Plot the bezier curve from the obtained points
for l = 1:np-1
plot([Q(l,1),Q(l+1,1)],[Q(l,2),Q(l+1,2)], '-- b', 'LineWidth', 2);
hold on
end

回答 (1 件)

Amish
Amish 2023 年 10 月 30 日
Hi Jinesh,
I understand that you are trying to create a surface by revolving the Bezier curve that you have made. The approach that I see in your code is that you are generating a fixed number of points that satisfy the equation and then plotting them. You can try to similarly do this for the case of 3D coordinates too if you already have control points for the curve available at hand.
The following MATLAB File exchange uses the similar algorithm and plots the 3D surface for the curve. I would request you to have a look at this: https://www.mathworks.com/matlabcentral/fileexchange/66678-bezier-surface
Hope this helps!

カテゴリ

Help Center および File ExchangeSurface and Mesh Plots についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by