306 Introduction to C++ Programming and Graphics
−5 0 5
−5
−4
−3
−2
−1
0
1
2
3
4
5
x
y
Figure 9.4.4 Animation of a bouncing circle inside a box generated byMat-
labthrough C++ code.
cout << "Hit return to finish\n";
fgetc(stdin);
return 0;
}
The graphics display is shown in Figure 9.4.4.
Problems
9.4.1. Write a code that defines data in the C++ domain and then calls
Matlabto display a cube.
9.4.2. Write a code that animates the rotation of a square. The data should
be produced in the C++ domain and transferred toMatlabfor visual-
ization.
9.5 Transferring data fromMatlabto the C++ domain.......
Data generated in theMatlabworkspace can be retrieved and stored in app-
ropriate variables in the C++ domain.