how do i plot control polygon?
21 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
NurFadhilah Samsuddin
am 15 Dez. 2020
Bearbeitet: VBBV
am 15 Dez. 2020
clc
clear all
close all
%control point for first surface
P0 = [0 0 0]; P1 = [1 0 0]; P2 = [2 0 0]; P3 = [3 0 0];
P4 = [0 1 0]; P5 = [1 1 2]; P6 = [2 1 2]; P7 = [3 1 0];
P8 = [0 2 0]; P9 = [1 2 2]; P10 = [2 2 2]; P11 = [3 2 0];
P12 = [0 3 0];
13 = [1 3 0]; P14 = [2 3 0]; P15 = [3 3 0];
phi=1;%scaling factor
B1=-1;%shape parameter lambda
B2=-1;%shape parameter miu
G17=phi*((2+B1)/(2+B2))*(P3-P2)+P3
G21=phi*((2+B1)/(2+B2))*(P7-P6)+P7
G25=phi*((2+B1)/(2+B2))*(P11-P10)+P11
G29=phi*((2+B1)/(2+B2))*(P15-P14)+P15
%control point for second surface
P3; G17; P18 = [5 0 0]; P19 = [6 0 0];
P7; G21; P22 = [5 1 0]; P23 = [6 1 0];
P11; G25; P26 = [5 2 0]; P27 = [6 2 0];
P15; G29; P30 = [5 3 0]; P31 = [6 3 0];
Gx=[P0(1) P1(1) P2(1) P3(1);P4(1) P5(1) P6(1) P7(1);P8(1) P9(1) P10(1) P11(1);P12(1) P13(1) P14(1) P15(1)];
Gy=[P0(2) P1(2) P2(2) P3(2);P4(2) P5(2) P6(2) P7(2);P8(2) P9(2) P10(2) P11(2);P12(2) P13(2) P14(2) P15(2)];
Gz=[P0(3) P1(3) P2(3) P3(3);P4(3) P5(3) P6(3) P7(3);P8(3) P9(3) P10(3) P11(3);P12(3) P13(3) P14(3) P15(3)];
Gx1=[P3(1) G17(1) P18(1) P19(1);P7(1) G21(1) P22(1) P23(1);P11(1) G25(1) P26(1) P27(1);P15(1) G29(1) P30(1) P31(1)];
Gy1=[P3(2) G17(2) P18(2) P19(2);P7(2) G21(2) P22(2) P23(2);P11(2) G25(2) P26(2) P27(2);P15(2) G29(2) P30(2) P31(2)];
Gz1=[P3(3) G17(3) P18(3) P19(3);P7(3) G21(3) P22(3) P23(3);P11(3) G25(3) P26(3) P27(3);P15(3) G29(3) P30(3) P31(3)];
N=20;
t=(1:N)'/N;
p=(pi/2)*t;
T=[p.^0 sin(p) (sin(p).^2) (sin(p).^3) cos(p) (cos(p).^2) (cos(p).^3)];
A=[1 0 0 1;
-(B1+2) (2+B1) 0 0;
((2*B1)+1) -(2+2*B1) 0 0;
-B1 B1 0 0;
0 0 2+B2 -(B2+2);
0 0 -((2*B2)+2) ((2*B2)+1);
0 0 B2 -B2];
TT=transpose(T);
AA=transpose(A);
z1 = T*A*Gx*AA*TT;
z2 = T*A*Gy*AA*TT;
z3 = T*A*Gz*AA*TT;
z4 = T*A*Gx1*AA*TT;
z5 = T*A*Gy1*AA*TT;
z6 = T*A*Gz1*AA*TT;
X = [z1 z4];
Y = [z2 z5];
Z = [z3 z6];
surf(X,Y,Z)
hold on;
hi, so i'm trying to plot control polygon for my surface, i tried plot(Gx) but it seems nothing comes out. i attached my coding and the following figure with control polygon is what i'm trying to achieve, thank you!

2 Kommentare
KSSV
am 15 Dez. 2020
What you have attached is not a polygon..it is a surface. What exactly you want?
Akzeptierte Antwort
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Assembly finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!