Simulink 3D Animation: how to compute the projection matrix associated with the camera view in a virtual reality world?

1 次查看(过去 30 天)
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?

采纳的回答

MathWorks Support Team
编辑:MathWorks Support Team 2024-5-8
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 个)

类别

Help CenterFile Exchange 中查找有关 Simulation 的更多信息

产品


版本

R2016a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by