extrude a 2d patch/surface to 3d volume
    조회 수: 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.

댓글 수: 0
답변 (1개)
  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
댓글 수: 0
참고 항목
카테고리
				Help Center 및 File Exchange에서 Polygons에 대해 자세히 알아보기
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

