Space coordinates of points in mesh
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
i have developed a mesh-model of a 3D tank in PDE Toolbox. For specifying the boundary conditions, I need the space coordinates of the points along the free surface/upper boundary. When using the command meshToPet in the PDE Toolbox, I am able to get the space coordinates of the points in the mesh. If I have 205 points along the upper boundary, do the first 205 rows of the p matrix correspond to these points along the upper boundary? Does the following command call the points along the upper boundary?
x=p(1,1:205);
If not, how do i call the elements along a boundary/edge? In what order are the points specified in the p matrix?
0 Commenti
Risposte (1)
Mann Baidi
il 2 Apr 2024
Modificato: Mann Baidi
il 2 Apr 2024
Hi Shreya,
As per my understanding of the above question, you would like to find the space coordinates for the upper surface of your 3D model. Assuming you currently have the mesh matrix as ‘p’.
For finding the coordinates of the upper surface in the ‘p’ matrix, you will need to find the indices where the z-coordinates has the maximum value. Then we can extract the space coordinates of the maximum z-coordinates using the ‘find’ function in MATLAB. You can refer to the below code for extracrting the coordinates.
Find the maximum z-coordinate value
max_z = max(p(3,:));
% Find indices of points with maximum z-coordinate
upper_boundary_indices = find(p(3,:) == max_z)
% Extract upper boundary points
upper_boundary_points = p(:,upper_boundary_indices);
Here is an illustration code which highlights the upper surface of a 3D model.
model = femodel(Geometry="BracketTwoHoles.stl");
model= generateMesh(model);
mesh=model.Geometry.Mesh;
pdeplot3D(mesh);
hold on
[p,y,z]= meshToPet(mesh);
% Find the maximum z-coordinate value
max_z = max(p(3,:));
% Find indices of points with maximum z-coordinate
upper_boundary_indices = find(p(3,:) == max_z);
% Extract upper boundary points
upper_boundary_points = p(:,upper_boundary_indices)
% Plotting the upper surface points with red color
scatter3(upper_boundary_points(1,:), upper_boundary_points(2, :), upper_boundary_points(3, :), 'MarkerEdgeColor', [1 0 0]);
hold off;
Feel free to explore more functionalities of 'find' function by using the documentation link below:
I hope this helps in resolving the query.
0 Commenti
Vedere anche
Categorie
Scopri di più su Geometry and Mesh in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!