View a 2-d projection of a 3D object
25 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I tried usind the matlab function "view" but it doesn't give a projected face
0 comentarios
Respuestas (1)
Shaik
el 11 de Mayo de 2023
Hi Lovett,
The view function in MATLAB sets the camera viewpoint for the current figure, but it does not render the 3D object in perspective. To render a 3D object in perspective so that it appears to have depth in a 2D image, you can use the camproj and camva functions to adjust the camera projection and field of view (FOV). Here's an example:
% Generate some random data
x = randn(100,1);
y = randn(100,1);
z = randn(100,1);
% Plot the data as a 3D scatter plot
figure;
scatter3(x,y,z);
% Adjust the view to a projected 2D view from above
camproj('perspective'); % set perspective projection
camup([0 1 0]); % set camera up direction
campos([0 0 max(z)]); % set camera position
camva(30); % set camera view angle
Ver también
Categorías
Más información sobre Lighting, Transparency, and Shading en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!