View Full Version : Corner/Edge Detection

KurtCob

04-09-2001, 01:32 AM

Hello guys,

Times ago I asked about a way to detect the corner, and some guys said that I have to measure the angle between the lines, (I made to vectors, one for each line, and then I taked the angle), but in this way the result was not good, does anyone know another way to detect the corner ?

Tnks

Best regards

Kurt

KurtCob

04-09-2001, 10:06 AM

????

KurtCob

04-11-2001, 02:20 AM

am I trying to do something that is impossible ???

Any help or tip will be apreciated.

Tnks

RGDS

Kurt

DaViper

04-11-2001, 02:25 AM

hmm what corner/edge do you want to detect???

If you are trying to detect a corner in your rendered buffer than it is getting pretty dirty, complicated and hmmm difficult.

Michael Steinberg

04-11-2001, 02:39 AM

Yeah, what do you want to do???

KurtCob

04-11-2001, 03:06 AM

Let's imagine that I have a cloud of points that describe my model, this model is structured in slices that are segment of lines, (polylines), now I want to know were are the corners in this polyline, you know, I have something like a curve, and in some place I have corners, and I want to detect these corners. Hope, I'm clear enough.

Thank you

Best regards

Kurt

KurtCob

04-11-2001, 03:09 AM

My corners is something like edges , sharp edges.

Tnks

RGDS

Kurt

DaViper

04-11-2001, 03:18 AM

hmm lets see if i got it.

You have your vertices and the lines which are connecting the vertices, and now you want to know which lines are in a plane and which lines are a corner of an object

[This message has been edited by DaViper (edited 04-11-2001).]

Michael Steinberg

04-11-2001, 03:54 AM

What's exactly the problem about it?

[This message has been edited by Michael Steinberg (edited 04-11-2001).]

KurtCob

04-11-2001, 04:18 AM

Yes , it is something like, do you want some picture ???

Tnks

RGDS

Kurt

DaViper

04-11-2001, 04:26 AM

just calcualte the normals of the 2 Polygon adjactet to each line. If the normals point in different directions you have a corner

KurtCob

04-11-2001, 04:33 AM

DaViper,

Do you want some picture ???

RGDS

Kurt

Michael Steinberg

04-11-2001, 04:36 AM

I wanna have a picture

KurtCob

04-11-2001, 04:43 AM

Look in your email.

DaViper

04-11-2001, 05:03 AM

yup send it to

schroll@lpr.e-technik.tu-muenchen.de

Michael Steinberg

04-11-2001, 05:26 AM

Now you have any three following points.

v1 = p2-p1;

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

cos(alpha) = (v1*v2)/(|v1|*|v2|)

alpha_degree = arcuscos(alpha);

if ( alpha_degree > max_degree ) {

// we've got a corner here

}

Well just wrote that down so I don't know if it's correct. Simply say that max_degree is 10 or so and you'll find the corners.

[This message has been edited by Michael Steinberg (edited 04-11-2001).]

[This message has been edited by Michael Steinberg (edited 04-11-2001).]

KurtCob

04-11-2001, 05:32 AM

Ok... I will try..

Tnks

RGDS

Kurt

Michael Steinberg

04-11-2001, 05:38 AM

Corrected my posting somewhat.

KurtCob

04-11-2001, 07:04 AM

Ok Michael,

So now, I want to create a new curve using the points that are the edges, in the method that you showed me, we have two vectors, how will I know witch of this is the point, that is the edge ?

Have you undertood my question ?

Tnks

RGDS

Kurt

KurtCob

04-11-2001, 07:11 AM

Hello,

I think I found the answer for my last question, P2 will be the point that the corner is, right ??

Tnks

RGDS

Kurt

Michael Steinberg

04-11-2001, 12:21 PM

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

Please correct my line from

v2 = p2-p3;

to

v2 = p3-p2;

Michael Steinberg

04-11-2001, 12:22 PM

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.

KurtCob

04-11-2001, 01:25 PM

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) = (v1*v2)/(|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

Michael Steinberg

04-11-2001, 01:44 PM

K, here's my final code snippet I believe... http://www.opengl.org/discussion_boards/ubb/smile.gif

v1 = p2-p1;

v2 = p3-p2;

alpha_cos = (v1*v2)/(|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.

Michael Steinberg

04-11-2001, 01:48 PM

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... http://www.opengl.org/discussion_boards/ubb/smile.gif

isn't that worth continuing ?

Powered by vBulletin® Version 4.2.5 Copyright © 2018 vBulletin Solutions Inc. All rights reserved.