makeanellip creates an open surface

35 views
Skip to first unread message

Sperta Solution

unread,
Sep 4, 2016, 4:21:15 PM9/4/16
to iso2mesh-users

Thank you for the great toolbox.

I'm trying to make three ellipsoids intersect each other and then take their union to get the outer surface. My code is as follows:

close all; clear all; clc;


[node1,face1,elem1]=meshanellip([0 0 0],[1 1 1], 1/10,0.4);
[node2,face2,elem2]=meshanellip([3 0 0],[3 1 1], 1/10,0.4);
[node3,face3,elem3]=meshanellip([0 0 1],[1 3 1], 1/10,0.4);


[newnode,newface] = mergemesh(node1,face1,node2,face2);
[newnode,newface] = mergemesh(newnode,newface,node3,face3);


figure
;
plotmesh
(newnode,newface, 'facecolor', 'w');


[newnode,newface] = surfboolean(node2,face2,'union', node1,face1);
[newnode,newface] = surfboolean(node3,face3,'union', newnode,newface);


figure
;
plotmesh
(newnode,newface, 'facecolor', 'w');


If you see the first figure, it shows the merged ellipsoids.


On the other hand, when I use surfboolean and take the union of all the surfaces, it gives me the following:


I suspect, it is taking the 3rd ellipsoid as an open surface. Could you please guide what is wrong with my code and why can't I get the closed outer surface of the three ellipsoids?



Qianqian Fang

unread,
Sep 4, 2016, 4:38:52 PM9/4/16
to iso2mes...@googlegroups.com
On 09/04/2016 01:39 PM, Sperta Solution wrote:

Thank you for the great toolbox.

I'm trying to make three ellipsoids intersect each other and then take their union to get the outer surface. My code is as follows:

I recently replaced the backend to the surfboolean (libGTS) to a new
robust surface boolean software - cork. With cork, the surf-boolean
operations no longer crashes, as did in libGTX.

In either cases, the surfboolean operator is sensitive to the
orientations of the surfaces. A flip of the triangle node orders,
such as face(:,[1 3 2]) or face(:,[2 1 3]) revert the space that
it enclosed - from inside to outside, or vise versa.

If you want to use the more robust surfboolean, please update iso2mesh
to the git version:

https://github.com/fangq/iso2mesh



close all; clear all; clc;


[node1,face1,elem1]=meshanellip([0 0 0],[1 1 1], 1/10,0.4);
[node2,face2,elem2]=meshanellip([3 0 0],[3 1 1], 1/10,0.4);
[node3,face3,elem3]=meshanellip([0 0 1],[1 3 1], 1/10,0.4);


[newnode,newface] = mergemesh(node1,face1,node2,face2);
[newnode,newface] = mergemesh(newnode,newface,node3,face3);

mergemesh simply concatenates elements without testing
their intersections. It should only be applied to non-intersecting
triangles/tetrahedral meshes.




figure
;
plotmesh
(newnode,newface, 'facecolor', 'w');


[newnode,newface] = surfboolean(node2,face2,'union', node1,face1);
[newnode,newface] = surfboolean(node3,face3,'union', newnode,newface);

if the output does not generate what you desired, try to revert
the node orders for face1 or face2.

you only need to pay attention when one of your surface operands
contains multiple enclosed shells. This way, cork will remove some
of the sub-surfaces due to the orientations of multiple layers. In that
case, you can replace 'union' to 'resolve' to keep all subsurfaces.

If you use the old libgts, you may use the operator 'all' to keep all
components. One of my students is working on adding the 'all'-like
output to cork.



figure
;
plotmesh
(newnode,newface, 'facecolor', 'w');


If you see the first figure, it shows the merged ellipsoids.

On the other hand, when I use surfboolean and take the union of all the surfaces, it gives me the following:

I suspect, it is taking the 3rd ellipsoid as an open surface. Could you please guide what is wrong with my code and why can't I get the closed outer surface of the three ellipsoids?


Qianqian


--
You received this message because you are subscribed to the Google Groups "iso2mesh-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to iso2mesh-user...@googlegroups.com.
To post to this group, send email to iso2mes...@googlegroups.com.
Visit this group at https://groups.google.com/group/iso2mesh-users.
For more options, visit https://groups.google.com/d/optout.

Sperta Solution

unread,
Sep 4, 2016, 10:02:28 PM9/4/16
to iso2mesh-users
Thanks for your prompt response. 

The following code works, in which I reverted the face order for one of the faces:

[newnode,newface] = surfboolean(node3,face3,'union', newnode,newface(:,[1 3 2]));


Could you please guide under which circumstances do I need to revert the face node order? It would be great if I can avoid hit-and-trial approach. One approach in my mind is to calculate the volume of the 'UNION' surface. If it increases, it means that the new volume has been added and the routine worked. If the volume decreases, it means the old surface has been cut and the routine didn't work, i.e., we need to change the order. Do you think the approach could work and if so, is there a way to calculate volume of the enclosed surface in iso2mesh?

you only need to pay attention when one of your surface operands
contains multiple enclosed shells. 

 That will always be the case. For example, I will add different ellipsoids in a for loop. So after the first iteration, one of the surface operand will contain multiple enclosed shell (intersecting with each other). 

I will give you the updates for using the new version of surfboolean shortly.

Thanks.

Sperta Solution

unread,
Sep 4, 2016, 10:09:44 PM9/4/16
to iso2mesh-users
The updated GIT version has the same problem and the same solution worked on it.

Thanks.
Reply all
Reply to author
Forward
0 new messages