Screen (2D) projection of 3D plot
Afficher commentaires plus anciens
How can I get the screen projection (2D) of the following 3D plot:
h = ezplot3('t', 'sin(t)', '20*cos(t)', [0 10*pi]);

The following solution as in the example in viewmtx() does NOT achieve the expected result (although it does for e.g. h = ezplot3('cos(t)', 'sin(t)', 'sin(5*t)', [-pi pi])):

% Original data
data = get(h,{'XData','YData','Zdata'});
data = [cat(1,data{:})', ones(numel(data{1}),1)];
% Projection matrix
[az,el] = view();
A = viewmtx(az,el);
% Projected data
data_transformed = A*data';
plot(data_transformed(1,:), data_transformed(2,:))
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Mathematics dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
