Contact US

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Angle between 3 points on a contour

Angle between 3 points on a contour

Angle between 3 points on a contour

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.


RE: Angle between 3 points on a contour

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.

RE: Angle between 3 points on a contour

If I had to guess, I would think you are going to end up using a magnitude function and the law of sines/cosines.

RE: Angle between 3 points on a contour

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)'  ?

RE: Angle between 3 points on a contour

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)'  ?

RE: Angle between 3 points on a contour

.... and you will now be looking for local minimum (most negative) of Bk

(2B)+(2B)'  ?

RE: Angle between 3 points on a contour

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.


Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members! Already a Member? Login


Low-Volume Rapid Injection Molding With 3D Printed Molds
Learn methods and guidelines for using stereolithography (SLA) 3D printed molds in the injection molding process to lower costs and lead time. Discover how this hybrid manufacturing process enables on-demand mold fabrication to quickly produce small batches of thermoplastic parts. Download Now
Design for Additive Manufacturing (DfAM)
Examine how the principles of DfAM upend many of the long-standing rules around manufacturability - allowing engineers and designers to place a part’s function at the center of their design considerations. Download Now
Taking Control of Engineering Documents
This ebook covers tips for creating and managing workflows, security best practices and protection of intellectual property, Cloud vs. on-premise software solutions, CAD file management, compliance, and more. Download Now

Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close