# How to find angle in vb with given coordinates

• ### Question

I know the two rectangles upper left corner coordinates(15,15) & (16.12 , 17.08) . How to find Angle from this in vb?

Thanks.

Friday, November 17, 2017 6:23 AM

### All replies

• I know the two rectangles upper left corner coordinates(15,15) & (16.12 , 17.08) . How to find Angle from this in vb?

If that's all you know then it's not sufficient.  You need to know two coordinates for each of the left-hand edges of the rectangle.  I think you are assuming that for rectangle 1 the left hand edge is vertical, so you can easily calculate another coordinate (eg, 15,35), but there is not enough information to calculate a second coordinate for the left-hand edge of rectangle 2.

When you have two sets of coordinates for each line you can find the intersection of the two lines.  That gives you three points: the intersection, and any one point on each of the lines.  That's enough to calculate the angle.  Or, when you have two sets of coordinates for each line you can find the slope of each line and subtract to find the difference.

Friday, November 17, 2017 7:23 AM