Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations KootK on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Angle between 3 points on a contour

Status
Not open for further replies.

mailpulak

Mechanical
Nov 3, 2010
10
Hi all,
I am new to Matlab and i am stuck in this problem.

(File attached for reference)
I have a set of points (coplanar) which makes a shape and encloses onto itself. I want to run loop which finds the inside angle between three points and give me back the results. All the contours I have will be having 4 sharp(pointing inwards) separate points. I want to detect these points.

Actually I'll be running another loop which will do the above for many contours.

Thanks in advance.

-Pulak
 
Replies continue below

Recommended for you

I don't understand the problem. More specifically, what do you mean by "inside angle between three points?" I understand that you have a contour made up of some finite set of points...but that's about it.
 
If I had to guess, I would think you are going to end up using a magnitude function and the law of sines/cosines.
 
Here's a solution that comes to mind:

Let's say I look at a point Pk=(xk, yk).

I can estimate a unit tangent vector on LHS as
Tk = (Pk - Pk-1) / |Pk - Pk-1|

I can estimate a unit tangent vector on RHS as
Tk+1 = (Pk+1 - Pk) / |Pk+1 - Pk|

We're looking for abrupt changes in angle of the unit tangent vector from one side to the other. To detect this I would look at the magnitude of the cross product of unit tangent vectors from one side to the other.
Zk = |Tk+1 x Tk|

Zk It should vary from 0 if no change in slope to 1.0 if there is a right angle change. The estimate of the change in slope at point k is arcsin(Zk). Look for local maxima of Zk as indiator of inflection points. This is sort of a first order model, and there may be better. Also noise in the data would of course make it trickier.




=====================================
(2B)+(2B)' ?
 
One way that algorithm could get fooled is if there is a change greater than 90 degrees from left to right, that algorithm would get fooled.

Perhaps better to look at dot-product of adjacent points
Bk = Tk+1 dot Tk

That dot product Bk goes from 1 if no change to -1 if complete reversal. Angle change is arcos(Bk)

=====================================
(2B)+(2B)' ?
 
.... and you will now be looking for local minimum (most negative) of Bk

=====================================
(2B)+(2B)' ?
 
Thanks for the replies guys!!
The attached file is the shoulder/chest level layer of a data plot of 3D scan of a human body. The task is to auto detect the arm pits and the crotch area. So in the attached file when we move down from top, the sharp angles will grow towards each other and finally separating themselves to form circular contours of arm. So the idea is to auto detect(by running a loop for each contour) the largest inside angles which near the armpits will be clearly more than 200 degrees.

I hope this clarifies a lot of things.
Thanks for the solution. I'll see if I can work it out.

-Pulak
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor