필터 지우기
필터 지우기

how to draw this geometry OF TWO SHAPES?

조회 수: 3 (최근 30일)
Ms
Ms 2022년 2월 8일
답변: Ganesh 2024년 6월 13일
I want to draw the attached geometry using decsg ? thanks

답변 (1개)

Ganesh
Ganesh 2024년 6월 13일
Hi @Ms,
For creating the given figure, you need to break down the figure into three parts. Using the 2D Geometry definition, we need to construct the following segments of the figure:
  1. The Outer Rectangle: Lets assume it is of dimensions 6*9 in this case
  2. Inner Rectangle: Let's assume it is of dimensions 4*7 in this case
  3. The Semi Circle: Due to the rectangle constraints, the Semi Circle will be of radius 3, centered on the middle of the lowest edge.
You may learn more on constructing 2D Geometry figures using the following documentation link:
The following code achieves what you are looking for:
R1 = [3 4 -3 -3 3 3 -4.5 4.5 4.5 -4.5];
R2 = [3 4 -2 -2 2 2 -3.5 3.5 3.5 -3.5];
C1 = [1 0 -4.5 3 0 0 0 0 0 0];
geom_matrix = [R1' R2' C1'];
set_formula = '(R1+C1)-R2';
% Use decsg to create the geometry
[dl, bt] = decsg(geom_matrix, set_formula, char('R1', 'R2','C1')');
figure; % Creates a new figure window
pdegplot(dl, 'EdgeLabels', 'on');
axis equal; % Ensures the aspect ratio is equal to accurately represent the geometry
title('Geometry: Outer Rectangle Minus Inner Rectangle');
xlabel('x');
ylabel('y');
[dl2,bt2] = csgdel(dl,bt);
figure
pdegplot(dl2,"EdgeLabels","on","FaceLabels","on")
xlim([-1.5,1.5])
axis equal
Hope it helps!

카테고리

Help CenterFile Exchange에서 Geometry and Mesh에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by