Geometry error when Creating CSG Geometry at the Command Line!!!!!
9 次查看(过去 30 天)
显示 更早的评论
I want to create a 2-D rail Geometry like this.

I used the command line to create the geometry and plot the figure of the geometry. Things go right so far.
But when I call initmesh function to mesh the Geometry. Error occurred like this:
Error using initmesh>chkTopology (line 426)
Invalid geometry detected. Vertices at the following locations have
only one connected edge.
(-75,8.544)
(-71.4477,12.4)
(-75,8.544)
(-71.4477,12.4)
(-49.88,14.8291)
(-49.88,14.8291)
(-41.7086,16.6305)
(-41.7086,16.6305)
(-23.8,22.6)
(-23.8,22.6)
(-10.2,39.6)
(-10.2,39.6)
(-10.4,120.3)
(-10.4,120.3)
(-13.3,129.7)
(-13.3,129.7)
(-17.6516,133.4)
(-17.6516,133.4)
(-35.395,161.8)
(-25.35,173.8)
(-35.395,161.8)
(-10,175.8)
(-25.35,173.8)
(10,175.8)
(-10,175.8)
(25.35,173.8)
(10,175.8)
(35.395,161.8)
(25.35,173.8)
(35.395,161.8)
(17.6516,133.4)
(17.6516,133.4)
(13.3,129.7)
(13.3,129.7)
(10.4,120.3)
(10.4,120.3)
(10.2,39.6)
(10.2,39.6)
(23.8,22.6)
(23.8,22.6)
(41.7086,16.6305)
(41.7086,16.6305)
(49.8809,14.8291)
(49.8809,14.8291)
(71.4477,12.4001)
(75,8.544)
(71.4477,12.4001)
(75,8.544)
All vertices must have two or more connected edges. This error may
be caused by two vertices being only approximately coincident.
Error in initmesh (line 95)
chkTopology(p, e);
| |I do not know how to do to solve this problem. Anyone can help me with it??
Here is the code:||
gTM1 = [
2 1 2 1 2 1 1 1;
-75 -71.4477 -71.4477 -49.88 -41.7086 -23.8 -10.2 -10.4;
-75 -75 -49.88 -41.7086 -23.8 -10.2 -10.4 -13.3;
2 12.4 12.4 14.8291 16.6305 22.6 39.6 120.3;
8.544 8.544 14.8291 16.6305 22.6 39.6 120.3 129.7;
0 1 0 0 0 0 0 0;
1 0 1 1 1 1 1 1;
0 -71 0 -54.3577 0 -30.1016 -408.258 -35.2721;
0 8.4252 0 54.5778 0 41.5813 78.9637 117.774;
0 4 0 40 0 20 400 25;
0 0 0 0 0 0 0 0;
0 0 0 0 0 0 0 0;
];
gTM2 = [
1 2 2 2 1 1 1 1;
-13.3 -17.6516 -35.0607 -36.4242 -25.35 -10 10 25.35;
-17.6516 -35.0607 -36.4242 -35.395 -35.395 -25.35 -10 10;
129.7 133.4 139.2189 141.2165 173.8 175.8 175.8 173.8;
133.4 139.2189 141.2165 161.8 161.8 173.8 175.8 175.8;
0 0 0 0 1 1 1 1;
1 1 1 1 0 0 0 0;
-20.3164 0 0 0 -22.412 -7.3874 0 7.3874;
125.8569 0 0 0 161.1364 95.8427 -124.033 95.8427;
8 0 0 0 13 80 300 80;
0 0 0 0 0 0 0 0;
0 0 0 0 0 0 0 0;
];
gTM3 = [
1 2 2 2 1 1 1 1;
35.395 35.395 36.4242 35.0607 17.6516 13.3 10.4 10.2;
25.35 36.4242 35.0607 17.6516 13.3 10.4 10.2 23.8;
161.8 161.8 141.2156 139.2189 133.4 129.7 120.3 39.6;
173.8 141.2156 139.2189 133.4 129.7 120.3 39.6 22.6;
1 0 0 0 0 0 0 0;
0 1 1 1 1 1 1 1;
22.412 0 0 0 20.3164 35.2721 408.2584 30.1016;
161.1364 0 0 0 125.8569 117.774 78.9637 41.5813;
13 0 0 0 8 25 400 20;
0 0 0 0 0 0 0 0;
0 0 0 0 0 0 0 0;
];
gTM4 = [2 1 2 1 2 2 2 2;
23.8 41.7086 49.8809 75 75 75 73 -73;
41.7086 49.8809 71.4477 71.4477 75 73 -73 -75;
22.6 16.6305 14.8291 8.544 8.544 2 0 0;
16.6305 14.8291 12.4001 12.4001 2 0 0 2;
0 0 0 1 0 0 0 0;
1 1 1 0 1 1 1 1;
0 54.3577 0 71 0 0 0 0;
0 54.5778 0 8.4252 0 0 0 0;
0 40 0 4 0 0 0 0;
0 0 0 0 0 0 0 0;
0 0 0 0 0 0 0 0;
];
gTM=[gTM1 gTM2 gTM3 gTM4];
figure()
pdegplot(gTM,'EdgeLabels','on');
xlim([-80,80])
ylim([-5,200])
[pTM,eTM,tTM] = initmesh(gTM,'Hmax',30,'Hgrad',1.3, 'MesherVersion', 'R2013a');
0 个评论
回答(1 个)
Alan Weiss
2016-4-15
Did you make your geometry by using decsg or by making the decomposed geometry matrices by hand? I strongly suggest that you use decsg. And that you first check the geometry using csgchk. It is quite error-prone and hard to debug a hand-made geometry matrix, as you are finding out.
You can also use the PDE app to draw the segments of your geometry. The PDE app allows you to edit each shape separately to make it exactly what you want. Then you can export the geometry from the app for subsequent use in command-line functions.
You can also use a geometry function instead of matrices to define your geometry. You are unlikely to end up with invalid geometry from a geometry function, though it can be a pain to create.
Good luck,
Alan Weiss
MATLAB mathematical toolbox documentation
3 个评论
Alan Weiss
2016-4-20
Sorry, I have no idea about how other software might or might not work with PDE Toolbox.
Alan Weiss
MATLAB mathematical toolbox documentation
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Geometry and Mesh 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!