MATLAB Answers

How to calculate from three points the "normal" at the second point

5 views (last 30 days)
Dany DA CRUZ BORGES
Dany DA CRUZ BORGES on 2 Apr 2020
Commented: Matt J on 3 Apr 2020
Hello !
To program an active contour, I would need from the coordinates of 3 points to determine the normal of the second point.
As in the picture, I would have to determine the normal for point "a".
Any idea?
Thank you

  3 Comments

David Goodmanson
David Goodmanson on 2 Apr 2020
Hi Dany,
how do propose to define the normal at point A? Is it halfway in between the two dotted normals that you show, or is it something else?
Dany DA CRUZ BORGES
Dany DA CRUZ BORGES on 2 Apr 2020
I have the x and y coordinates of the 3 points. And yes I seek to establish the vector which is at the level of A thanks to the coordinates (x, y) of the point which is on the left of A, of A and the point which is on the right of A.I have the x and y coordinates of the 3 points. And yes I seek to establish the vector which is at the level of A thanks to the coordinates (x, y) of the point which is on the left of A, of A and the point which is on the right of A.

Sign in to comment.

Answers (1)

Matt J
Matt J on 2 Apr 2020
Edited: Matt J on 2 Apr 2020
Once you have answered David's question, the attached function should be useful. It will find the normals to all the facets of a 2D polygon. Example,
Vertices=[0 0; 1 0; 0 1]; %vertices of a triangle
normals=vert2con_special(Vertices)
gives as output,
normals =
0 -1
1 1
-1 0

  6 Comments

Show 3 older comments
John D'Errico
John D'Errico on 3 Apr 2020
There is no tangent at a point of slope discontinuity. Until you define how you will treat this, there is no way to answer your question.
Dany DA CRUZ BORGES
Dany DA CRUZ BORGES on 3 Apr 2020
I would have to calculate the tangent as in the image below, then determine the normal to this tangent.
Matt J
Matt J on 3 Apr 2020
You could use John's minboundcircle function in this FEX contribution,
to find the green circle shown in your illustration. The normal will then simply be the ray A-O from the center of the circle to the point A.

Sign in to comment.

Sign in to answer this question.