extrude a 2d patch/surface to 3d volume

7 ビュー (過去 30 日間)
saad sulaiman
saad sulaiman 2022 年 10 月 18 日
回答済み: Ayush 2023 年 8 月 30 日
from a set of data points, I have already plotted a 2d surface and now I would like to extrude it as a volume, just like in any CAD software. for simplicity, I have attached a picture of a simple patch with the coordinates and so, I would like to add thickness to it in z-direction.

回答 (1 件)

Ayush
Ayush 2023 年 8 月 30 日
Hi Saad,
I understand that you want to extrude your 2D patch into a 3D volume by adding some thickness in the Z-direction.
It can be done in the following manner:
1. Add the z-coordinates in your vertex matrix (in your case variable “x”). Here is a sample code for your reference:
% Create the vertex matrix with added z-coordinate for extrusion
vertices = [
x, zeros(size(x, 1), 1); % Original vertices with z-coordinate = 0
x, ones(size(x, 1), 1); % Vertices extruded in the z-direction with z-coordinate = 1
];
2. Add the corresponding faces to the face matrix (in your case variable “y”). Here is a sample code for your reference:
faces = [
1, 2, 4, 3; % Face 1 (vertices 1, 2, 4, 3)
1, 2, 6, 5; % Face 2 (vertices 1, 2, 6, 5)
1, 3, 7, 5; % Face 3 (vertices 1, 3, 7, 5)
.
.
.
];
3. Use the “patch” function to make the respective polygon. You can refer to the below documentation to know more about the “patch” function:
4. Add the line of code “view(3)” to visualise the 3D volume. You can refer to the below documentation to know more about the “view” function:
Hope this helps,
Regards,
Ayush Misra

カテゴリ

Help Center および File ExchangePolygons についてさらに検索

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by