libigl v2.5.0
Loading...
Searching...
No Matches
matlabinterface.h
Go to the documentation of this file.
1// This file is part of libigl, a simple c++ geometry processing library.
2//
3// Copyright (C) 2013 Daniele Panozzo <daniele.panozzo@gmail.com>
4//
5// This Source Code Form is subject to the terms of the Mozilla Public License
6// v. 2.0. If a copy of the MPL was not distributed with this file, You can
7// obtain one at http://mozilla.org/MPL/2.0/.
8#ifndef IGL_MATLAB_MATLAB_INTERFACE_H
9#define IGL_MATLAB_MATLAB_INTERFACE_H
10#include "../igl_inline.h"
11// WARNING: These functions require matlab installed
12// Additional header folder required:
13// /Applications/MATLAB_R2011a.app/extern/include
14// Additional binary lib to be linked with:
15// /Applications/MATLAB_R2011a.app/bin/maci64/libeng.dylib
16// /Applications/MATLAB_R2011a.app/bin/maci64/libmx.dylib
17
18// MAC ONLY:
19// Add to the environment variables:
20// DYLD_LIBRARY_PATH = /Applications/MATLAB_R2011a.app/bin/maci64/
21// PATH = /opt/local/bin:/opt/local/sbin:/Applications/MATLAB_R2011a.app/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/texbin:/usr/X11/bin
22
23#include <Eigen/Core>
24#include <Eigen/Sparse>
25#include <string>
26
27#include <complex>
28#include <cassert>
29#include <map>
30#include <string>
31#include <vector>
32
33#include <engine.h> // Matlab engine header
34
35namespace igl
36{
37 namespace matlab
38 {
43 IGL_INLINE void mlinit(Engine** engine);
44
48 IGL_INLINE void mlclose(Engine** engine);
49
55 IGL_INLINE void mlsetmatrix(Engine** engine, std::string name, const Eigen::MatrixXd& M);
56
58 IGL_INLINE void mlsetmatrix(Engine** engine, std::string name, const Eigen::MatrixXf& M);
59
61 IGL_INLINE void mlsetmatrix(Engine** engine, std::string name, const Eigen::MatrixXi& M);
62
64 IGL_INLINE void mlsetmatrix(Engine** mlengine, std::string name, const Eigen::Matrix<unsigned int, Eigen::Dynamic, Eigen::Dynamic >& M);
65
67 IGL_INLINE void mlsetmatrix(Engine** mlengine, std::string name, const Eigen::SparseMatrix<double>& M);
68
74 IGL_INLINE void mlgetmatrix(Engine** engine, std::string name, Eigen::MatrixXd& M);
75
77 IGL_INLINE void mlgetmatrix(Engine** engine, std::string name, Eigen::MatrixXf& M);
78
80 IGL_INLINE void mlgetmatrix(Engine** engine, std::string name, Eigen::MatrixXi& M);
81
83 IGL_INLINE void mlgetmatrix(Engine** mlengine, std::string name, Eigen::Matrix<unsigned int, Eigen::Dynamic, Eigen::Dynamic >& M);
84
90 IGL_INLINE void mlsetscalar(Engine** engine, std::string name, double s);
91
93 IGL_INLINE double mlgetscalar(Engine** engine, std::string name);
94
101 IGL_INLINE std::string mleval(Engine** engine, std::string code);
102 }
103}
104
105// Be sure that this is not compiled into libigl.a
106#ifndef IGL_STATIC_LIBRARY
107# include "matlabinterface.cpp"
108#endif
109
110#endif
#define IGL_INLINE
Definition igl_inline.h:15
void mlclose(Engine **engine)
Closes the MATLAB engine.
void mlsetscalar(Engine **engine, std::string name, double s)
Send a single scalar to MATLAB.
std::string mleval(Engine **engine, std::string code)
Execute arbitrary MATLAB code and return the MATLAB output.
double mlgetscalar(Engine **engine, std::string name)
This is an overloaded member function, provided for convenience. It differs from the above function o...
void mlsetmatrix(Engine **engine, std::string name, const Eigen::MatrixXd &M)
Send a matrix to MATLAB.
void mlinit(Engine **engine)
Init the MATLAB engine (no need to call it directly since it is automatically invoked by any other co...
void mlgetmatrix(Engine **engine, std::string name, Eigen::MatrixXd &M)
Receive a matrix from MATLAB.
Definition AABB.h:17