2015-04-29 22:00 GMT+10:00 Yu Jing <[email protected]>: > created on Matlab, and it seems to be impossible to input the coordinates of > thousands of points by hand, is it possible to import geometry from matlab > output?
Hello. I'm not sure whether there's an automatic importer but what I
have done in the past in similar cases is generate .geo scripts for
Gmsh in MATLAB. (Actually I used Octave, but that's effectively
equivalent for the present purpose.) I attach a simple example:
u = 2 * pi * sort (rand (1, 2^7));
xy = diag([1; (1 + sqrt(5) / 2)]) * [cos(u); sin(u)];
for p = 1:columns(xy)
printf("Point(%d) = {%g, %g, 0};\n", p, xy(:, p))
if p > 1
printf("Line(%d) = {%d, %d};\n", p - 1, p - 1, p)
end%if
end%for
printf("Line(%d) = {%d, 1};\n", p, p)
Call this with "octave -f polygon.m > polygon.geo", then "gmsh polygon.geo".
u = 2 * pi * sort (rand (1, 2^7));
xy = diag([1; (1 + sqrt(5) / 2)]) * [cos(u); sin(u)];
for p = 1:columns(xy)
printf("Point(%d) = {%g, %g, 0};\n", p, xy(:, p))
if p > 1
printf("Line(%d) = {%d, %d};\n", p - 1, p - 1, p)
end%if
end%for
printf("Line(%d) = {%d, 1};\n", p, p)
polygon.geo
Description: Binary data
_______________________________________________ gmsh mailing list [email protected] http://www.geuz.org/mailman/listinfo/gmsh
