Projecting a point along normal direction

So there is the InterX code available on matlab which finds out where two curves intersect.
Basically given two curves A and B,I select a point in A,and then project it along the normal direction.
Then I use InterX to find where this projection will meet the curve B
This is the code i am currently referring to
the projection part is in in line 19-23.
But doing so gives me the following result.So i want to know if i want to project along normal direction,then is this method correct,and what can be done to ensure that points are projected along the normal.
The normals on this curve are as follows
have enclosed the set of points as well as the normals

 Respuesta aceptada

KSSV
KSSV el 15 de Sept. de 2021

0 votos

7 comentarios

sparsh garg
sparsh garg el 15 de Sept. de 2021
hmmm tried this on the following set of points the result is a 2x2 matrix and not a 2x8 vector as per doc
I tried using a different input matrix 2x44 o/p is again a 2x2 matrix.
KSSV
KSSV el 15 de Sept. de 2021
How did you input the points? The vertices should be Nx2. Did you try the same way?
sparsh garg
sparsh garg el 15 de Sept. de 2021
Editada: sparsh garg el 15 de Sept. de 2021
in the comment it's mentioned vertices should be 2XN,which is consistent with my current set of points 2x740
inputs,
% V : List of points/vertices 2 x M
% (optional)
% Lines : A N x 2 list of line pieces, by indices of the vertices
% (if not set assume Lines=[1 2; 2 3 ; ... ; M-1 M])
%
% outputs,
% N : The normals of the Vertices 2 x M
sparsh garg
sparsh garg el 15 de Sept. de 2021
ok was able to get them
sparsh garg
sparsh garg el 15 de Sept. de 2021
one last thing,when I calculate the angle,between the two components of Nx and NY the angle should be 90 but i see that some of the values are 167,17837 38 degrees etc.Any idea why this is happening
KSSV
KSSV el 15 de Sept. de 2021
Check the units you are using. They are in degrees or radians?
sparsh garg
sparsh garg el 15 de Sept. de 2021
Editada: sparsh garg el 15 de Sept. de 2021
degree this is how their projection comes out
using angles computed from normals
using 90 degree instead of the angle
projection code is as follows
xc=x-10*cosd(angles(i));yc=y-10*sind(angles(i));
L1=[x xc;y yc];
the new normals computed from LineCurvature2D ,angles and the subset of spline_pts is as follows

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Networks en Centro de ayuda y File Exchange.

Preguntada:

el 15 de Sept. de 2021

Editada:

el 15 de Sept. de 2021

Community Treasure Hunt

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

Start Hunting!

Translated by