Hi Ali,
I understand that you want to generate a structured triangular mesh where the line connecting the center of gravity of each triangle is orthogonal to the triangle's edges, aiming for minimal triangles.
I assume you are using PDE Toolbox for mesh generation and visualization. Here the steps you can follow:
Define Geometry:
Start by defining the geometry of the domain you want to mesh. You can use the pdegplot function to visualize the geometry
% Define geometry (example: unit circle)
g = decsg([1, 0, 0, 1]'); % Circle with radius 1
pdegplot(g);
Initialize the Mesh: Use the initmesh function to create an initial mesh for your geometry. This function returns the points (p), edges (e), and triangles (t) of the mesh.
% Initialize the mesh
[p, e, t] = initmesh(g);
Refine the Mesh: Optionally, use refinemesh to refine the initial mesh. This step can help in achieving a more structured mesh by increasing the number of triangles.
% Refine the mesh to improve structure
[p, e, t] = refinemesh(g, p, e, t);
Visualize the Mesh: Use the pdemesh function to visualize the generated mesh. This helps in verifying the structure and orthogonality of the mesh.
% Visualize the mesh
pdemesh(p, e, t);
Adjusting Mesh for Orthogonality: Ensuring orthogonality of gravity centers may require custom mesh manipulation, which might not be directly achievable with standard functions. Consider using custom algorithms or manual adjustments for precise control.
Refer to the documentation following functions for more info about them:
- pdegplot: https://www.mathworks.com/help/pde/ug/pdeplot.html
- initmesh: https://www.mathworks.com/help/pde/ug/initmesh.html
- refinemesh: https://www.mathworks.com/help/pde/ug/refinemesh.html
Hope this helps!