Simulink 3D Animation: how to compute the projection matrix associated with the camera view in a virtual reality world?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
MathWorks Support Team
el 12 de Dic. de 2016
Editada: MathWorks Support Team
el 8 de Mayo de 2024
I am using Simulink 3D Animation to model a virtual reality environment.
In MATLAB, how do I calculate the projection of the world in the same way as it is rendered on the screen?
Respuesta aceptada
MathWorks Support Team
el 8 de Mayo de 2024
Editada: MathWorks Support Team
el 8 de Mayo de 2024
We will use the "Membrane" example for Simulink 3D Animation:
You can get the position and direction of the camera using the following code example:
>> wh = vrworld('membrane.wrl');
>> open(wh);
>> view(wh);
>> fig = get(wh, 'Figures');
>> dir = get(fig, 'CameraDirection');
>> pos = get(fig, 'CameraPosition');
You may need the Field Of View (FOV) of the camera.
First, get the name of the currently used viewpoint:
>> get(fig, 'Viewpoint')
If there is a viewpoint, get the FOV of each viewpoint:
>> vp = get(wh, 'Viewpoints');
>> getfield(vp, 'fieldOfView')
If there is no viewpoint, the FOV is set to the default value specified by the VRML Standard: 0.785398 radians (45 degrees).
Please refer to the following link for more information on the VRML standard:
0 comentarios
Más respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!