Eliminate curves in the model

1 view (last 30 days)
N G
N G on 7 Jun 2024
Commented: Ganesh on 7 Jun 2024
I am trying to model a thrust pad bearing. I have modeled it using a polygon and 2 circles. How do I eliminate the circles from the model? I just need the rectangle with curves.
Code:
rect1 = [3
4
0.1789
0.40735
0.5205
0.2286
0.14231
0.32402
0
0];
C1=[1
0
0
0.2286];
C2=[1
0
0
0.5205];
C1 = [C1;zeros(length(rect1) - length(C1),1)];
C2 = [C2;zeros(length(rect1) - length(C2),1)];
gd = [rect1,C1,C2];
ns = char('rect1','C1','C2');
ns = ns';
sf='(rect1+C2)-C1';
[dl,bt] = decsg(gd,sf,ns);
pdegplot(dl,"EdgeLabels","on","FaceLabels","on")
xlim([-1.5,1.5])
axis equal

Accepted Answer

Ganesh
Ganesh on 7 Jun 2024
Hi @N G,
When you access "dl", you will find it to be a matrix. In your case "dl" contains 16 elements, each of which corresponds to the edge number you see in the original figure. I used this idea to extract the required edges from the given figure and plot the figure you are looking for. Please find the code attached below:
rect1 = [3
4
0.1789
0.40735
0.5205
0.2286
0.14231
0.32402
0
0];
C1=[1
0
0
0.2286];
C2=[1
0
0
0.5205];
C1 = [C1;zeros(length(rect1) - length(C1),1)];
C2 = [C2;zeros(length(rect1) - length(C2),1)];
gd = [rect1,C1,C2];
ns = char('rect1','C1','C2');
ns = ns';
sf='(rect1+C2)-C1';
[dl,bt] = decsg(gd,sf,ns);
pdegplot(dl(:,[1 2 8 13]),"EdgeLabels","on","FaceLabels","on")
Warning: Unable to display some or all face labels because the geometry is invalid. Check if edges overlap or intersect at non-end points. Mesh generation can also fail for this geometry.
% Do note the Warning Message, and ensure that Meshing is possible for any
% future use
xlim([0.1,0.6])
axis equal
Note: Ideally, it is advised to find the boundary conventionally and then use it to plot and mesh.
  1 Comment
Ganesh
Ganesh on 7 Jun 2024
I have found the root cause of the issue. It seems that, in your figure, an extra edge and face is being formed. This might be arising due to a precision issue.
At the intersection you can see "E14" and "F4", which is restricting the model from forming when we use only the 4 required edges. Do note that there are no warnings when we include E14 and generate the plot, and setting the "FaceLabels" and "EdgeLabels" to "off".
Perhaps you can make the rectangle freely intersect the outer circle instead of the vertices intersecting?

Sign in to comment.

More Answers (0)

Tags

Products


Release

R2024a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!