Bonjour tout le monde,je veux savooir comment creer un fichier .obj(creer un objet) à partir des X Y et Z,autrement dit,j'ai les X,Y et Z et je veux construire l'objet qui le forment et le sauvegarder dans un fichier .obj, comment ça ce fait sachant que j'ai arrivé à afficher l'objet dans une figure?
voici le code:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
global CXa
global CXb
global CYa
global CYb
global CZa
global CZb
global degre
global degree
global n
global coef
global NbrS
global Ba
global Bb
 
 
global phig thetag
 
 
 
 
delta=1/10;
theta = 0 : delta : pi;         % altitude
phi = 0 : 2*delta : 2*pi;       % azimuth
[phi,theta] = meshgrid(phi,theta);
 
 
 
 
[ne,nne]=size(phi)
k=1;
for i=1:ne
    for j=1:nne    
         thetag(k,1)=theta(i,j);
         phig(k,1)=phi(i,j);
         k=k+1;
    end 
end
 
 
[NbrS,Nbb]=size(thetag)
[coef] = InitialMatriceCoef(degre);
 
 
degre
% pause
%function [Ba,Bb]=CalculMatriceB(degree,coef)
[Ba,Bb]=CalculMatriceB(degre,coef);
 
 
size(Ba)
size(CXa)
degre
MMx=Ba*CXa(:,1)+Bb*CXb(:,1);
MMy=Ba*CYa(:,1)+Bb*CYb(:,1);
MMz=Ba*CZa(:,1)+Bb*CZb(:,1);
 
 
 
 
k=1;
for i=1:ne
    for j=1:nne
        X(i,j)=MMx(k,1);
        Y(i,j)=MMy(k,1);
        Z(i,j)=MMz(k,1);
        k=k+1;
    end
end
figure
 
 
surf(X,Y,Z)
light
lighting phong
shading interp
colormap(cool)
axis('square')
%axis([-5 5 -5 5 -5 5])
axis('off')
%saveobj(surf(X,Y,Z))
view(40,30)