Corner/Edge Detection

Yes, p2 is the point on the corner (or not-corner)!

Please correct my line from

v2 = p2-p3;
to
v2 = p3-p2;

Yoi have to ensure the direction the vectors point into. My solution assumed p2 is following p1 and p3 is following p1, all in ONE order.

Tnks Michael.

The fact is that I would be able to try just on friday, because I had a problem with my computer, then when I have the result, I will give you an answer, anyway thank you very much for ALL your help.

PS.: The final process will be like this :

v1 = p2-p1;
v2 = p3-p2; // This is a simple flip because I want the angle to be near 0 degrees not near 180 degrees

cos(alpha) = (v1v2)/(|v1||v2|)
alpha_degree = arcuscos(alpha);

if ( alpha_degree > max_degree ) {
// we’ve got a corner here
}

arcuscos = what is this ? is the same as acos() ?

And the point that I have to use, in my new “curve”, that will describe all the edges,is pt2 (off course, if it is an edge), please correct me if I´m wrong.

Best regards

Kurt

K, here’s my final code snippet I believe…

v1 = p2-p1;
v2 = p3-p2;

alpha_cos = (v1v2)/(|v1||v2|)
alpha_radians = acos(alpha_cos);
alpha_degrees = alpha_radians * 180 / pi; // convert from radians to degrees

if ( alpha_degree > max_degree ) {
// we’ve got a corner here
}

And the point that I have to use, in my new “curve”, that will describe all the edges,is pt2 (off course, if it is an edge), please correct me if I´m wrong.

I don’t completely understand what you mean with that.

No problem.

Just had the idea to an even better way doing that.

Consider 5 following points on your “curve”.

Get the angles at point 2, 3 and 4. If the angle at point 3 is not near the average of the angles at point 2 and 4, you’ve got a corner here. This way you can argue with percents rather than a preset maximum angle. It still has some problems though… So try to stick with the first way…

isn’t that worth continuing ?