## Angle between 3 points on a contour

## Angle between 3 points on a contour

(OP)

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

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

## RE: Angle between 3 points on a contour

## RE: Angle between 3 points on a contour

## RE: Angle between 3 points on a contour

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

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

=====================================

(2B)+(2B)' ?

## RE: Angle between 3 points on a contour

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