Merge pull request #34 from MattiaMontanari/33-error-using-mex-matlab-under-linux

Build mex on linux
fixes-turtlebasket
Mattia Montanari 2022-11-01 09:57:48 +01:00 committed by GitHub
commit 7a018a3c60
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View File

@ -38,11 +38,11 @@ end
% TRY COMPILING MEX FILE % TRY COMPILING MEX FILE
fprintf('Compiling mex function... ') fprintf('Compiling mex function... ')
try try
mex(fullfile('..','..','src','openGJK.c'),... % Source of openGJK mex(fullfile('..','..','openGJK.c'),... % Source of openGJK
'-largeArrayDims', ... % Support large arrays '-largeArrayDims', ... % Support large arrays
optflug, ... % Compiler flag for debug/optimisation optflug, ... % Compiler flag for debug/optimisation
fullfile('-I..','..','include'),... % Folder to header files fullfile('-I','..','..','include'),... % Folder to header files
'-outdir', pwd,... % Ouput directory for writing mex function '-outdir', pwd, ... % Ouput directory for writing mex function
'-output', 'openGJK',... % Name of ouput mex file '-output', 'openGJK',... % Name of ouput mex file
'-DMATLAB_MEX_BUILD',... % Define variable for mex function in source files '-DMATLAB_MEX_BUILD',... % Define variable for mex function in source files
silflag ) % Silent/verbose flag silflag ) % Silent/verbose flag

View File

@ -730,7 +730,7 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) {
nCoordsB = mxGetN(prhs[1]); nCoordsB = mxGetN(prhs[1]);
/* Create output */ /* Create output */
plhs[0] = mxCreategkFloatMatrix(1, 1, mxREAL); plhs[0] = mxCreateDoubleMatrix(1, 1, mxREAL);
/* get a pointer to the real data in the output matrix */ /* get a pointer to the real data in the output matrix */
distance = mxGetPr(plhs[0]); distance = mxGetPr(plhs[0]);
@ -763,7 +763,7 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) {
s.nvrtx = 0; s.nvrtx = 0;
/* Compute squared distance using GJK algorithm */ /* Compute squared distance using GJK algorithm */
distance[0] = gjk(bd1, bd2, &s); distance[0] = compute_minimum_distance(bd1, bd2, &s);
mxFree(arr1); mxFree(arr1);
mxFree(arr2); mxFree(arr2);