MATLAB is a wide-used tool for visualisation. The idea is to easily transfer MATLAB-based geometry into Omegalib without using a detour via a PLY file. We developed the first draft of an Omegalib module that collects data from MATLAB to visualise it in Omegalib.
For an introduction into Omegalib, please read the Omegalib Tutorial series.
What is the daMatlab Module about?
The current version of the daMatlab modules provides a transfer of point clouds and surfaces (triangles and quads), determined by vertices, faces, vertex or face normals, and color. The transmission of the geometry data is implemented by using UDP sockets where MATLAB acts as a client and the daMatlab module as a server.
The server is always listening to incoming data. If a valid data set has arrived an ModelGeometry
object is created and added to a queue. As soon as the function addNewGeometry()
is called and the queue is not empty, a ModelGeometry
is retrieved and added to the SceneManager
.
How to run the daMatlab Module?
You need a running instance of MATLAB and the Python code of MatlabModule.py
, which is is located in
local/examples/daMatlab
It shows how to retrieve a ModelGeometry
from the queue once it is available. Start the module in the Linux shell with
orun /local/examples/daMatlab/MatlabModule.py
Afterwards, start MATLAB and run either sphere_quads.m
or sphere_triangles.m
. Both files can be found in
/local/examples/daMatlab/MATLAB
The code of MatlabModule.py
:
from cyclops import *
from daMatlab import *
port = 30000
ip = "127.0.0.1"
mm = MatlabModule.createAndInitialize()
mm.startDataReader(ip, port)
scene = mm.getSceneManager()
program = ProgramAsset()
program.name = "MatlabModule"
scene.addProgram(program)
# Update function
def onUpdate(frame, t, dt):
# retrieves ModelGeometry from the queue if it is available and adds it to the SceneManager
mm.addNewGeometry()
# register the update function
setUpdateFunction(onUpdate)
Next Step: Transferring the Data