Borrar filtros
Borrar filtros

Why inpolygon is not detecting the whole artificial reef structure?

33 visualizaciones (últimos 30 días)
Tanziha Mahjabin
Tanziha Mahjabin el 19 de Ag. de 2024 a las 13:41
Comentada: Tanziha Mahjabin el 20 de Ag. de 2024 a las 7:12
Hi,
I'm encountering a problem while trying to adjust the bathymetry in my MATLAB code. I have successfully plotted the artificial reef structure. However, I'm having difficulty modifying the bathymetry to reflect a 4-meter depth for the structure instead of the initial 5 meters. I am using the inpolygon function, but it seems to be causing some issues and not detecting the whole structure.
The code plots correctly up to line 77, but I'm experiencing problems with the polygon section. I've attached the MATLAB code for review.
Could you please help me identify what might be going wrong?
Thank you!

Respuestas (1)

akshatsood
akshatsood el 19 de Ag. de 2024 a las 14:17
I understand that you are experiencing issues with the "inpolygon" function not detecting the entire structure. To address this, I have proposed a change to your MATLAB code for ensuring Polygon Closure.
I have modified the "x_poly" and "y_poly" arrays to ensure that the polygon is properly closed. This is crucial because an open polygon can lead to incorrect results with "inpolygon". The revised definitions append the starting point of the polygon to the end of the arrays, ensuring that the shape is closed. Below are the updated lines:
x_poly = [x_fill_arc, fliplr(x_fill_arm(1,:)), x_fill_arm(1,:), x_fill_arc(1)];
y_poly = [y_fill_arc, fliplr(y_fill_arm(1,:)), y_fill_arm(1,:), y_fill_arc(1)];
I hope this helps.
  3 comentarios
akshatsood
akshatsood el 19 de Ag. de 2024 a las 17:37
Could you please mention the outcomes you are expecting so that I can provide a more specific advice.
Tanziha Mahjabin
Tanziha Mahjabin el 20 de Ag. de 2024 a las 7:12
If I run upto line 77, I get the correct structure (attached figure).
But with inpolygon it is not selecting the whole structure.

Iniciar sesión para comentar.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by