Many thanks Joe and Dan

With your help I have now managed to get my intercepts to work.

This is what the my code looks like for anyone else who might need to do

this.

Regards

Ian

'This calculates the intersection points of two overlapping circles

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

Private Sub FindIntercepts()

Dim XintersectA As Single 'first x intersect

Dim YintersectA As Single 'first y intersect

Dim XintersectB As Single 'second x intersect

Dim YintersectB As Single 'second y intersect

Dim d, r, s, h, k, m, n As Single ' intermediate variables to make

expression easier to write and follow

Dim CheckOverLap As Boolean

r = R1

s = R2

h = Centre1X

k = Centre1Y

m = Centre2X

n = Centre2Y

d = Sqr((((m - h) ^ 2) + ((n - k) ^ 2)))

If Sqr((h - m) ^ 2 + (k - n) ^ 2) <= (r + s) Then ' Check for

overlap to avoid run time error

CheckOverLap = True

'expression to find the XintersectA value

''''''

XintersectA = ((m + h) / 2) + ((m - h) * ((r ^ 2) - (s ^ 2))) / (2

* (d ^ 2)) + (((n - k) / (2 * (d ^ 2))) * Sqr(((((r + s) ^ 2) - (d ^ 2)) *

((d ^ 2) - ((s - r) ^ 2)))))

'expression to find the YintersectA value

'''''

YintersectA = ((n + k) / 2) + ((n - k) * ((r ^ 2) - (s ^ 2))) / (2 *

(d ^ 2)) - (((m - h) / (2 * (d ^ 2))) * Sqr(((((r + s) ^ 2) - (d ^ 2)) * ((d

^ 2) - ((s - r) ^ 2)))))

'expression to find the XintersectB value

'''''

XintersectB = ((m + h) / 2) + ((m - h) * ((r ^ 2) - (s ^ 2))) / (2 *

(d ^ 2)) - (((n - k) / (2 * (d ^ 2))) * Sqr(((((r + s) ^ 2) - (d ^ 2)) * ((d

^ 2) - ((s - r) ^ 2)))))

'expression to find the YintersectB value

'''''

YintersectB = ((n + k) / 2) + ((n - k) * ((r ^ 2) - (s ^ 2))) / (2 *

(d ^ 2)) + (((m - h) / (2 * (d ^ 2))) * Sqr(((((r + s) ^ 2) - (d ^ 2)) * ((d

^ 2) - ((s - r) ^ 2)))))

Pic2.Cls

Pic2.Print " First X intersect = " & Round(XintersectA, 2)

Pic2.Print " First Y intersect = " & Round(YintersectA, 2)

Pic2.Print ""

Pic2.Print " Second X intersect = " & Round(XintersectB, 2)

Pic2.Print " Second Y intersect = " & Round(YintersectB, 2)

Pic2.Print ""

Else

Pic2.Print " Overlap = " & CheckOverLap

MsgBox ("No overlap of circles. Cannot solve."), , ("Intercept

Check")

End If

Pic1.ForeColor = vbYellow

Pic1.Circle (XintersectA, YintersectA), 0.3

Pic1.Circle (XintersectB, YintersectB), 0.3

End Sub

Quote:

> > I require to calculate the intersection points of two overlapping

circles.

> > The expression for the two circles are:

> > Circle1

> > (x-h)^2 + (y-k)^2 = r^2

> > Circle2

> > (x-m)^2 + (y-n)^2 = s^2

> > Where h,k,m and n are the respective centres offset from the zero origin

and

> > r and s are the respective radii.

> You can get an approximation, or at least find out if the circles

> are likely to intersect at all, by finding where these squares

> intersect:

> line (h-r, k-r) - (h+r, k+r), , b

> line (m-s, n-s) - (m+s, n+s), , b

> Or maybe start by seeing if sqr((h-m)^2 + (k-n)^2) <= (r+s)

> --

> Joe Foster <mailto:jlfoster%40znet.com> Got Thetans?

<http://www.xenu.net/>

Quote:

> WARNING: I cannot be held responsible for the above They're

coming to

> because my cats have apparently learned to type. take me away,

ha ha!