Surfboolean Problem.

56 views
Skip to first unread message

Anqi L

unread,
Jul 5, 2019, 11:27:21 AM7/5/19
to iso2mesh-users


Hello,

 I have a wired problem while using the function Surfboolean. For two intersecting mesh surface, while using the Surfboolean with option 'and', I am expecting the surface of the intersected region, but sometimes i obtain the mesh that belongs to option 'diff'. Or when i use option 'union', but I obtain the mesh for option 'first' etc.

It seems that sometimes, the option and the mesh generated is not coincide. However, this only happen occasionally.

Option 'and' is always correct (cause nothing needs to be removed from it), but I do not have the fourth column in newelem indicating which part is the element belongs to.

Thank you for helping me out! Also, thank the author for developing such nice meshing tool!

Regards,
Anqi

Qianqian Fang

unread,
Jul 5, 2019, 12:04:37 PM7/5/19
to iso2mes...@googlegroups.com, Anqi L

hi Anqi

to make sure surfboolean works as expected, you must "reorient" the surface triangles consistently (i.e., the node order must be in counter-clock-wise order, in order words, the normal dir points outward).

To correct surface element orientation, you need to call surfreorient() or meshcheckrepair(). Then, in the surfboolean call, you need to flip one of the surface's direction by swapping any two columns.

For example

[no1,fc1]=meshabox([0 0 0],[10 10 10],1);     % a box mesh
[no2,fc2]=meshasphere([10 10 10], 8, 0.4);    % a sphere mesh
[no1,fc1]=meshcheckrepair(no1,fc1);           % orient surface 1
[no2,fc2]=meshcheckrepair(no2,fc2);           % orient surface 2
[no3,fc3]=surfboolean(no1,fc1,'and',no2,fc2(:,[2 1 3])); % two surfs should have reverted direction
plotmesh(no3,fc3)

For simple compartment surface, the flipping in direction may not be necessary, but if you have multiple shells, this can produce different results.

hope this helps.

Qianqian



Regards,
Anqi
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/iso2mesh-users/d5275abb-d440-47ef-a2f2-7e9c71687c0e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Anqi L

unread,
Jul 5, 2019, 1:50:24 PM7/5/19
to iso2mesh-users
Hello Qianqian,

Thank you for the explanation.
 I will check the orientation of my mesh. It should be the problem!

Regards,
Anqi 

在 2019年7月5日星期五 UTC+2下午6:04:37,Qianqian Fang写道:
On 7/5/19 10:50 AM, Anqi L wrote:


Hello,

 I have a wired problem while using the function Surfboolean. For two intersecting mesh surface, while using the Surfboolean with option 'and', I am expecting the surface of the intersected region, but sometimes i obtain the mesh that belongs to option 'diff'. Or when i use option 'union', but I obtain the mesh for option 'first' etc.

It seems that sometimes, the option and the mesh generated is not coincide. However, this only happen occasionally.

Option 'and' is always correct (cause nothing needs to be removed from it), but I do not have the fourth column in newelem indicating which part is the element belongs to.

Thank you for helping me out! Also, thank the author for developing such nice meshing tool!


hi Anqi

to make sure surfboolean works as expected, you must "reorient" the surface triangles consistently (i.e., the node order must be in counter-clock-wise order, in order words, the normal dir points outward).

To correct surface element orientation, you need to call surfreorient() or meshcheckrepair(). Then, in the surfboolean call, you need to flip one of the surface's direction by swapping any two columns.

For example

[no1,fc1]=meshabox([0 0 0],[10 10 10],1);     % a box mesh
[no2,fc2]=meshasphere([10 10 10], 8, 0.4);    % a sphere mesh
[no1,fc1]=meshcheckrepair(no1,fc1);           % orient surface 1
[no2,fc2]=meshcheckrepair(no2,fc2);           % orient surface 2
[no3,fc3]=surfboolean(no1,fc1,'and',no2,fc2(:,[2 1 3])); % two surfs should have reverted direction
plotmesh(no3,fc3)

For simple compartment surface, the flipping in direction may not be necessary, but if you have multiple shells, this can produce different results.

hope this helps.

Qianqian



Regards,
Anqi
--
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 iso2mes...@googlegroups.com.

Anqi L

unread,
Jul 17, 2019, 8:20:01 AM7/17/19
to iso2mesh-users
Hello Qianqian,

I have tired to correct the surface element orientation before calling function Surfboolean(), as in sample1.png two surface mesh have reverted orientation after I called meshcheckrepair() and inverted one of the mesh. But still when using surfboolean() with command "and" I obtained something in sample2. Is there any reason why it is happening?

Thank you in advance!
Best regards,
Anqi




在 2019年7月5日星期五 UTC+2下午6:04:37,Qianqian Fang写道:
On 7/5/19 10:50 AM, Anqi L wrote:


Hello,

 I have a wired problem while using the function Surfboolean. For two intersecting mesh surface, while using the Surfboolean with option 'and', I am expecting the surface of the intersected region, but sometimes i obtain the mesh that belongs to option 'diff'. Or when i use option 'union', but I obtain the mesh for option 'first' etc.

It seems that sometimes, the option and the mesh generated is not coincide. However, this only happen occasionally.

Option 'and' is always correct (cause nothing needs to be removed from it), but I do not have the fourth column in newelem indicating which part is the element belongs to.

Thank you for helping me out! Also, thank the author for developing such nice meshing tool!


hi Anqi

to make sure surfboolean works as expected, you must "reorient" the surface triangles consistently (i.e., the node order must be in counter-clock-wise order, in order words, the normal dir points outward).

To correct surface element orientation, you need to call surfreorient() or meshcheckrepair(). Then, in the surfboolean call, you need to flip one of the surface's direction by swapping any two columns.

For example

[no1,fc1]=meshabox([0 0 0],[10 10 10],1);     % a box mesh
[no2,fc2]=meshasphere([10 10 10], 8, 0.4);    % a sphere mesh
[no1,fc1]=meshcheckrepair(no1,fc1);           % orient surface 1
[no2,fc2]=meshcheckrepair(no2,fc2);           % orient surface 2
[no3,fc3]=surfboolean(no1,fc1,'and',no2,fc2(:,[2 1 3])); % two surfs should have reverted direction
plotmesh(no3,fc3)

For simple compartment surface, the flipping in direction may not be necessary, but if you have multiple shells, this can produce different results.

hope this helps.

Qianqian



Regards,
Anqi
--
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 iso2mes...@googlegroups.com.
sample2.png
sample1.png

Qianqian Fang

unread,
Jul 17, 2019, 11:11:38 AM7/17/19
to iso2mes...@googlegroups.com, Anqi L
On 7/17/19 8:20 AM, Anqi L wrote:
Hello Qianqian,

I have tired to correct the surface element orientation before calling function Surfboolean(), as in sample1.png two surface mesh have reverted orientation after I called meshcheckrepair() and inverted one of the mesh. But still when using surfboolean() with command "and" I obtained something in sample2. Is there any reason why it is happening?


hi Anqi

orientation/boolean does not usually work with open surfaces, but I am glad to see that cork is able to process (to some extent).

Because for an open source, there is no definite definition of "out" or "in", I am not entirely sure the expected behavior of the boolean operator.

Qianqian


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.
Reply all
Reply to author
Forward
0 new messages