Vector loop angle and direction

4 visualizaciones (últimos 30 días)
Izan Segarra
Izan Segarra el 6 de En. de 2022
Respondida: arushi el 29 de Dic. de 2023
I am working with a 2D array that forms an XY loop and I am trying to get the dominant angle and direction of the loop. I have used principal component analysis (PCA) and obtained the maximum norm of each pair of points but it is not a robust method.... It works correctly for a loop as seen in the first image (fig1.png), however, the second image (fig2.png) should give a similar result and it is detected backwards. Is there any methodology or algorithm that provides a good result?
  4 comentarios
Mathieu NOE
Mathieu NOE el 8 de En. de 2022
seems the side where the arrow should point to is always the "smooth" side that ressemble to a half elipse
am I wrong ?
maybe we could discriminate the quadrant based on data smoothness or a R² coefficient if we wanted to fit a parabola
Izan Segarra
Izan Segarra el 11 de En. de 2022
Editada: Izan Segarra el 11 de En. de 2022
Sometimes, the direction is marked by abrupt data... ( As you can see in the image below) I think that it's necesary to combine different methods to detect the direction correctly.

Iniciar sesión para comentar.

Respuestas (1)

arushi
arushi el 29 de Dic. de 2023
Hi Izan,
I understand that you want to know a different method for finding the direction and angle other than PCA. Principal Component Analysis (PCA) is a statistical method that can be used to determine the principal directions of a dataset. However, PCA itself does not provide information about the orientation or directionality of a loop; it only gives the axes of maximum variance. When dealing with loops or closed curves, the directionality can be ambiguous, and PCA might not be the best tool to determine the dominant angle and direction of the loop. If you are looking for a consistent way to determine the orientation of a loop, you might consider using methods that are more geometric in nature.
Here are a few methodologies and algorithms that could potentially provide a more robust result for determining the dominant angle and direction of a loop:
Curve Orientation:
  • Calculate the signed area of the loop. A positive or negative area can indicate the direction of traversal (clockwise or counterclockwise).
  • Use the "shoelace formula" to compute the signed area and infer the direction based on the sign.
  • Documentation for the same - https://en.wikipedia.org/wiki/Curve_orientation
Curve Fitting:
  • Fit an ellipse to the data points using methods like the Direct Least Square Fitting of Ellipses. The orientation of the ellipse can give you the dominant angle.
  • The direction of the loop can be inferred by tracking the sequential order of points along the fitted ellipse.
Angular Histogram:
  • Compute the angles between consecutive points (or vectors) along the loop and create a histogram.
  • The peak of the histogram can indicate the dominant angle, and the sequence of angles can give directionality.
Traveling Direction:
  • If the loop represents a trajectory, you may be able to use the time series data or index ordering to determine the traveling direction.
When implementing these methods, it's important to consider the possibility of noise and outliers in your data, as they can significantly affect the results. Preprocessing steps such as smoothing or filtering might be necessary to obtain a clearer signal of the loop's orientation and direction.
Hope this helps.
Thank you

Categorías

Más información sobre Dimensionality Reduction and Feature Extraction en Help Center y File Exchange.

Productos


Versión

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by