Clear Filters
Clear Filters

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

1 view (last 30 days)
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?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 8 May 2024
Edited: MathWorks Support Team on 8 May 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:
 

More Answers (0)

Categories

Find more on Simulation in Help Center and File Exchange

Products


Release

R2016a

Community Treasure Hunt

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

Start Hunting!