Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

Code Example of how would I calculate the angle of two intersecting lines.

Example:

If I have a V shaped object and one line is .75 and the other line is .50 what is the angle between the two lines.

Thanks in advance for your assistance.

Example:

If I have a V shaped object and one line is .75 and the other line is .50 what is the angle between the two lines.

Thanks in advance for your assistance.

You simply need trigonometry.

What you have is the legs of the V form a hypotenuse, and distance between the open ends of the V is a double set of "Opposites".

(See http://www.mathsisfun.com/sine-cosine-tangent.html or simply google sin, cos, tan or trigonometric functions).

In this case, sin = opposite / hypotenuse. Your 'opposite' would be 1/2 of the 50, and your hypotenuse would be the legs of the V.

From there, you just need to use the trigonometric functions in the math library of what ever computer language you might be using. Specifically you need the inverse sin function (many call that asin).

Angle = asin( 75 / 25 ) '25 being 1/2 of 50

The library is likely to give you the answer in radians (where 3.14 radians = 180 degrees).

VB6 doesn't have a built-in Arc-sine function. It only has:

sine ( sin() )

cosine ( cos() )

tangent ( tan() )

ArcTangent ( Atn() )

But you can use math to calculate an ArcSine():

Arcsin(X) = Atn(X / Sqr(-X * X+1))

Again, that formula is going to give you an answer in radians. If you need it in degrees, multiply by 180 and divide by 3.14159265359

2 of the sides are 75. (The V)

1 of the sides is 50. (The base)

Your description of the situation is inadequate, so that the experts are having to guess what you mean.

Assuming that you are talking about two lines in the same plane, the best way to describe the lines is by their start and end points. This would which require four pairs of x and y co-ordinates, one pair for each end of each line.

Otherwise figures could simply refer to the gradients of each line. If so, the intersecting angle will be simply be the difference between the two angles.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.

NOTE: From what I researched about VB6 neither the ASIN function nor a PI funciton exist, so you have to supply your own.

Open in new window