When we want to find where a line that bisects a circle intersects the circle's circumference, we usually use simultaneous equations. For example, for the circle and line:
(x - a)2 + (y - b)2 = r2
and
y = mx + c

We could set it so:

(x - a)2 + (y - b)2 - r2 = mx + c - y

And then solve for everything we need. Anyone who's taken too many algebra classes can tell you that. Here's another way to do it.

Imagine we have a vertex and a circle equation:
(x,y)
and
(x1 - a)2 + (y1 - b)2 = r2

Two useful diagonals can be derived:
The line segment between the circle's center and the vertex
Using these diagonals, we can form two right triangles:

```
A
/|
/ |
/  |
/   |
/    |
/     |
_.-""""-/_     |
.'       /| `.   |
/        / |   \  |
|        /  |    | |
|       /___|____|_|
|                |
\              /
`._        _.'
`-....-'
```
The larger line has been derived by using the x and y components of the vertex A. The smaller line and the larger line are just line segments of the same line. The two triangles are similar triangles, meaning that they have the same angles and length ratios as each other, except they're just different sizes.

If we find the ratio of the lengths of the two diagonals, we can use that ratio to find the lengths of the horizontal and vertical sides of the smaller triangle. Let's put in some real numbers. We'll call our vertex A. Let's say we have the following properties:

Ax = 6 (vertex x)
Ay = 7 (vertex y)
a = 0 (circle center x)
b = 0 (circle center y)

Our drawing now looks like this:

```
A(6,7)
/|
/ |
/  |
/   |
/    |
/     |
_.-""""-/_     |
.'       /| `.   |
/        / |   \  |
|        /  |    | |
|       /___|____|_|
|    (0,0)       |
\              /
`._        _.'
`-....-'
```
Firstly, let's work out the x and y lengths of the larger triangle. We'll call these lengths dAx and dAy respectively. To find the lengths of these, we simply subtract the x and y components from each other.

dAx = 6 - 0 = 6
dAy = 7 - 0 = 7

Using these, we can ask our friend pythagoras how to find the length of the hypotenuse of the larger triangle. We'll call this d.

```     _______    _______    __
d = √62 + 72 = √36 + 49 = √85 = ±9.2195
```
Now we want to find the ratio of the small diagonal to the large diagonal. We know that the smaller diagonal's length is r (3), because the radius of the circle is 3 and any line between the center and the circumference of a circle is always the same as that circle's radius.

Now we'll find the ratio of the diagonals' lengths. We'll call this k.

k = r/d = 3 / ±9.2195 = ±0.3254

So that's our ratio. Now we want to find the lengths of the horizontal and vertical sides of the small triangle. To do this, we just multiply the larger horizontal and vertical lengths by this ratio. We'll call the new lengths dx1 and dy1

dx1 = dAx * k = 6 * ±0.3254 = ±1.9524
dy1 = dAy * k = 7 * ±0.3254 = ±2.2778

Now if we add these lengths to the circle's center, we find the intersect points.

a + dx1 = 0 ± 1.9524 = ±1.95
b + dy1 = 0 ± 2.2778 = ±2.28

So, the line intersects the circle in two places:
(1.95, 2.28) and
(-1.95, -2.28).

Note that there are two solutions to this problem, since lines that bisect circles will pass through two points on the circle's circumference. If your circle has a center of (0,0), then once you've found one point of intersection, simply flip the signs on the x and y components to find the other point of intersection.

Oh, and here's a practical application of this method in a mIRC script I wrote:

```
alias circlestuff {
window -pek @circle
%circle_r = 100
%circle_center_x = 101
%circle_center_y = 101
drawdot @circle 4 %circle_r %circle_center_x %circle_center_y
drawdot @circle 1 \$calc(%circle_r - 1) %circle_center_x %circle_center_y
}
sclick: {
clear @circle
circlestuff
%hyp = \$Sqrt(\$calc((\$mouse.x - %circle_center_x)^2 + (\$mouse.y - %circle_center_y) ^ 2)))
%ratio = \$calc(%hyp / %circle_r)
titlebar %ratio
%x_len = \$calc(\$calc(%circle_center_x - \$mouse.x) / %ratio)
%x_len = \$calc(%x_len / -1)
%a = \$acos(\$calc(%x_len / %circle_r)).deg
%x_pos = \$calc(%circle_center_x + %x_len)
%y_pos = \$calc(%circle_center_y \$iif(\$mouse.y > %circle_center_y,+,-) %circle_r * \$sin(%a).deg)
%y_len = \$calc(%circle_center_y - %y_pos)
;drawdot @circle 8 3 %x_pos %y_pos
drawline @circle 4 1 %circle_center_x %circle_center_y %x_pos %y_pos
drawline @circle 4 1 %circle_center_x %circle_center_y %x_pos %circle_center_y
drawline @circle 4 1 \$calc(%circle_center_x + %x_len) %circle_center_y %x_pos %y_pos
drawtext @circle 4 verdana 12 206 10 Hypotenuse length: %circle_r
drawtext @circle 4 verdana 12 206 30 X-side length: \$abs(\$round(%x_len,2))
drawtext @circle 4 verdana 12 206 50 Y-side length: \$abs(\$round(%y_len,2))
if (%a > 90) %a = \$calc(90 - (%a - 90))
drawtext @circle 4 verdana 12 206 70 Angle: \$round(%a,2)
}
}

```
To use: Copy/paste to your remotes editor in mIRC and type /circlestuff, then click around the window.

Log in or register to write something here or to contact authors.